我在我的Android项目中有一个JAR,我想将它添加到final APK中。好的,我开始了:
<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>但是当我运行mvn package时,我得到了一个警告:
[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 25在最后的APK中,没有JAR。
我该怎么解决这个问题呢?
发布于 2012-06-07 23:46:08
您需要通过add the jar连接到本地的maven存储库。或者(更好的选项)指定适当的存储库(如果存在),这样maven就可以自动下载它。
在这两种情况下,请从依赖项中删除<systemPath>标记
发布于 2015-06-24 17:59:44
我不知道真正的原因,但是Maven要求开发人员将所有的库(也是自定义的)安装到一些maven库中,所以scope:system不太受欢迎,一个简单的解决办法是使用maven-install-plugin
遵循用法:
这样写你的依赖项
<dependency>
<groupId>com.mylib</groupId>
<artifactId>mylib-core</artifactId>
<version>0.0.1</version>
</dependency>然后,添加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>注意phase:clean,要将自定义库安装到存储库中,必须先运行mvn clean,然后运行mvn install
发布于 2017-12-07 10:09:17
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>尝尝这个。
https://stackoverflow.com/questions/10935135
复制相似问题