jlars62
jlars62

Reputation: 7383

Maven from command line with multiple eclipse projects

Suppose I have the following file/project structure.

MSPCommon/trunk/pom.xml
MSPWebManager/trunk/pom.xml

and MSPWebManager depends on MSPCommon and MSPCommon and MSPWebManager are in the same directory.

I have imported these projects into eclipse, and within eclipse I can successfully do maven builds on MSPWebManager (like mvn clean compile) IF I do it the following way. Go to Run -> Run configurations, type in the maven commands AND select Resolve Workspace artifacts.

That's all great, but what I would like to be able to do is run the same maven commands from the command line. So I navigate to the MSPWebManager/trunk directory, do a mvn command like mvn clean compile and this is the result:

enter image description here

As you can see there is one other local jar that is missing, but for simplicity I only included one in this question because I'm assuming the fix is the same for them all.

Also, if I do some type of build within eclipse but I do NOT check the Resolve Workspace artifacts, I get the same error as I do on the command line.

Any suggestions on how to get this to work from the command line?

Thanks

Upvotes: 1

Views: 946

Answers (1)

Alexandre Santos
Alexandre Santos

Reputation: 8338

Go to the module MSPCommon and run a mvn clean install then go to MSPWebManager and do the mvn clean compile

mvn install resolves the dependencies and installs your build inside of your .m2 repository / folder.

Upvotes: 2

Related Questions