I am new with Maven and I have the following problem. I have a project A which I have added as dependency in another project.
This is what I have added to my pom
</build>
<dependencies>
<dependency>
<groupId>the id</groupId>
<artifactId>artifact id</artifactId>
<version> the version</version>
<scope>compile</scope>
</dependency>
In Eclipse everything is working, but when I try to open the jar file I get this message:
Caused by: java.lang.ClassNotFoundException: the name of project A
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
So what am I missing ? Any suggestions would be helpful
Eclipse does its own compilations automatically in the background. The result is that your dependency's jar file is probably available in Eclipse but not in your local maven repository. Try running "maven clean install" in the terminal on your local dependency first (this will add it to your local maven repository), then afterwards build your downstream project with another "maven clean install".
This will create a jar file in the "target" directory at the root of your maven project.