I have a project in eclipse (let’s call it project A) which is a Maven project. It is a library which is used by other projects.
And I have project B which is also a Maven project and it depends on project A. In project B’s pom.xml I have added a dependency referencing project A, and it builds and runs perfectly from Eclipse.
Now I want to build an executable JAR from project B. Previously I have done this by adding the maven-assembly-plugin plugin to the pom.xml and then running mvn assembly:single from the command line.
When I run mvn assembly:single command within project B it throws an error saying it cannot find project A.
Now what would be the best way to build the executable JAR for B? Is there a way to build it from Eclipse (and presumably it will handle the dependency references as it has been doing) or is there a way to tell Maven that project A is local and it should build project B using the local project A.
When using a Maven project as a dependency outside of Eclipse, you have to install it into the local repository first. You do this using the
installcommand:This quote is from the Maven in 5 Minutes tutorial.
The “problem” is that Eclipse will build Maven projects with its internal compiler like any other project. As Maven dependencies are mapped to normal Eclipse dependencies for that, you don’t have to
installyour projects. However, as soon as you actually use Maven to build them (even in Eclipse), you do.