0

I have the following project structure:

myproj
  +---myproj-parent
  +---myproj-data (war)
  +---myproj-util
  +---myproj-report (dependency on myproj-data)

I am able to "mvn clean install" the "myproj-data" and "myproj-util" projects and verify they are in my local repo by viewing the directories. In eclipse for the myproj-report pom.xml, I can also "right-click --> Maven --> Add Dependency", select both of them (e.g. "myproj-data-0.0.1-SNAPSHOT.war" and "myproj-util-0.0.1-SNAPSHOT.jar"), and everything up to this point seems is good.

The problem is that none of the classes in the myproj-data are available in myproj-report. That is, they all show the " cannot be resolved to a type" in eclipse, and produce the "package myproj.data.model.entity does not exist" and "cannot find symbol" errors when building from the command line. As best I can tell, the "myproj-data" and "myproj-util" projects are very similarly structured, with the only major differences being packaging type and several additional dependencies in myproj-data (for jpa and REST).

I have tried:

  1. clearing and rebuilding my local repo
  2. rebuilding and reinstalling the myprojc-data project (mvn clean install -U)
  3. removing and readding the myproj-data dependency
  4. deleting and recreating workspace
  5. removing and reimporting all projects (deleting .settings, target, .classpath, .project)
  6. triple checking versions, names, and everything else I can think of, etc..

...but I cannot figure out why the myproj-util dependencies are being recognized when the myproj-data are not.

How can I troubleshoot this?

swv
  • 691
  • 1
  • 12
  • 28
  • 1
    Because it is a WAR. So you need to attach the classes and depend on that instead. – Tunaki Feb 18 '16 at 20:05
  • i don't follow? how exactly do I attach the classes (vs. the war as a whole)? – swv Feb 18 '16 at 20:17
  • 1
    You can refer to the question I linked you to (there's the link on top of your question). Basically, you configure `maven-war-plugin` with `attachClasses` and then you depend on it with the classifier `classes`. – Tunaki Feb 18 '16 at 20:18
  • Sheesh. I've been so wrapped around the axle on this one, I completely missed the link at the top. that was it, thank you very much! – swv Feb 18 '16 at 20:25

0 Answers0