使用Maven命令安裝jar包到repo中


項目中可能會碰到很多jar包,使用maven update不能更新,或者jar包是拷貝過來,不能編譯的情況。此時就需要手動使用命令行安裝。

例如Demo項目中提示缺少四個jar包,但是在repo中已經有了,此時可以將四個jar包拷貝至一個文件夾中。

按住shift鍵,右鍵選擇用命令行打開

 

命令如下:

mvn install:install-file -Dfile=matt-autocode-1.0.0.jar -DgroupId=com.zeei -DartifactId=common -Dversion=1.0.0 -Dpackaging=jar

按照自己需要的,分別替換:文件名(-Dfile=?),組名(-DgroupId=?), jar包名(-DartifactId=?),jar包版本(-Dversion=?)

                     注意此處的的這些參數要與pom.xml文件中聲明的一致

Enter執行,隨后會看到執行成功的信息

如:

mvn install:install-file -Dfile=matt-ssm-web-2.0.0.jar -DgroupId=org.matt -DartifactId=matt-ssm-web -Dversion=2.0.0 -Dpackaging=jar

mvn install:install-file -Dfile=matt-ssm-core-1.0.0.jar -DgroupId=org.matt -DartifactId=matt-ssm-core -Dversion=1.0.0 -Dpackaging=jar

mvn install:install-file -Dfile=matt-ssm-persistent-2.0.0.jar -DgroupId=org.matt -DartifactId=matt-ssm-persistent -Dversion=2.0.0 -Dpackaging=jar

mvn install:install-file -Dfile=matt-component-2.0.0.jar -DgroupId=org.matt -DartifactId=matt-component -Dversion=2.0.0 -Dpackaging=jar

mvn install:install-file -Dfile=matt-utils-2.0.0.jar -DgroupId=org.matt -DartifactId=matt-utils -Dversion=2.0.0 -Dpackaging=jar

 

感謝老司機“簡單的事”提供的幫助!!!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM