简体   繁体   中英

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:

在此处输入图片说明

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM