1. 程式人生 > >IntelliJ IDEA中maven匯入本地jar包

IntelliJ IDEA中maven匯入本地jar包

1. 開啟cmd或者shell

2. 使用maven命令將本地jar包安裝到maven的本地repository中:

mvn install:install-file -Dfile=/home/username/GLPKSolverPack.jar -DgroupId=com.leyantech.ai -DartifactId=glpk -Dversion=1.0 -Dpackaging=jar

3. 在專案的pom.xml檔案中中加入相應的依賴

  1. <dependency>

  2. <groupId>com.leyantech.ai</groupId>

  3. <artifactId>glpk</artifactId>

  4. <version>1.0</version>

  5. </dependency>

4. 注意2和3中的groupId、artifactId、version保持一致