Maven Dependency error in Eclipse

java, maven

Solution

My simple answer is the following link to the bug tracking system of Eclipse:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=365419

See the answers inside.

Yes it's a problem with Eclipse itself..

The solution within Eclipse just add the project manually within your workspace to the appropriate project where you need the classes out of your war project.

Problem

I have a war artefact and I need use some of their classes from a jar. I can't move the classes to another project, then I deploy the classes and resources included in my webapp as an "attached" artifact using the following configuration: ``` <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <attachClasses>true</attachClasses> </configuration> </plugin> ``` This will result in two artifacts being deployed: mywebapp-1.0-SNAPSHOT.war and mywebapp-1.0-SNAPSHOT-classes.jar. To use those classes I Referencing the artifact as follows: ``` <dependency> <groupId>mygroup</groupId> <artifactId>mywebapp</artifactId> <version>${project.version}</version> <classifier>classes</classifier> </dependency> ``` When I compiled from Jenkins everything works correctly, but when I run the tests locally from Eclipse can not find the reference classes. (java.lang.NoClassDefFoundError) I think it might be a bug in the maven eclipse plugin, someone has any idea that can be happening?

Original source