Java – Maven dependency error in eclipse

I have a war artifact that I need to use some of their classes from the jar

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <attachClasses>true</attachClasses>
    </configuration>
</plugin>

This will result in the deployment of two artifacts: mywebapp - 1.0 - snapshot War and mywebapp-1.0-snapshot-classes jar.

To use these classes, I will reference artifacts as follows:

<dependency>
        <groupId>mygroup</groupId>
        <artifactId>mywebapp</artifactId>
        <version>${project.version}</version>
        <classifier>classes</classifier>
    </dependency>

Everything was fine when I compiled from Jenkins, but I couldn't find the reference class when I ran the test locally from eclipse (java.lang.NoClassDefFoundError)

I think it may be an error in the Maven Eclipse Plug-in. Does anyone have any ideas that can happen?

Solution

My simple answer is the following link to eclipse's bug tracking system:

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

Look at the answers inside

Yes, eclipse itself is a problem

The solution in eclipse is simply to manually add the project in your workspace to the corresponding project of the class you need in the project

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>