添加第三方库到Maven资源库
生活随笔
收集整理的這篇文章主要介紹了
添加第三方库到Maven资源库
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
問題:
在安卓、java、Scala中,總是要添加一些第三方的庫。在“pom.xml"添加如下: <dependency><groupId>com.loopj.android.http</groupId><artifactId>android-async-http</artifactId><version>1.3.2</version><type>jar</type><scope>system</scope><systemPath>${project.basedir}/libs/android-async-http-1.3.2.jar</systemPath></dependency> 運行時,就會出現錯誤: [WARNING] Some problems were encountered while building the effective model for **apk:1.0 [WARNING] 'dependencies.dependency.systemPath' for com.loopj.android.http:android-async-http:jar should not point at files within the project directory, ${project.basedir}/libs/android-async-http-1.3.2.jar will be unresolvable by dependent projects @ line 36, column 2官方解決辦法:
Guide to installing 3rd party JARs
··· mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> ···
官方推薦另外一種辦法
使用 Apache Maven Install Plugin
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-install-plugin</artifactId><version>2.5.2</version><executions><execution><id>install-external</id><phase>clean</phase><configuration><file>${basedir}/lib/mylib-core-0.0.1.jar</file><repositoryLayout>default</repositoryLayout><groupId>com.mylib</groupId><artifactId>mylib-core</artifactId><version>0.0.1</version><packaging>jar</packaging><generatePom>true</generatePom></configuration><goals><goal>install-file</goal></goals></execution></executions> </plugin>注意:你要在mvn install 之前使用 mvn clean
轉載于:https://my.oschina.net/greister/blog/830299
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的添加第三方库到Maven资源库的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【android】getCacheDir
- 下一篇: 王者棋牌怎么玩