[英]Maven: NoClassDefFoundError of system scoped dependency
I am developing an Android project with Maven. 我正在用Maven开发一个Android项目。 I have a third-party jar file that I have included in a
lib
folder on my project root directory: 我在项目根目录的
lib
文件夹中包含一个第三方jar文件:
<dependency>
<groupId>com.parse</groupId>
<artifactId>parse</artifactId>
<version>1.9.2</version>
<scope>system</scope>
<systemPath>${project.basedir}\lib\Parse-1.9.2.jar</systemPath>
</dependency>
But when I install the apk in my phone, I get NoClassDefFoundError
. 但是,当我在手机中安装apk时,会出现
NoClassDefFoundError
。 Obviously, that class exists inside the jar. 显然,该类存在于jar中。
How can I do? 我能怎么做?
Thanks. 谢谢。
I would suggest using one of your directories as a repository, add your jar in it, and load it the proper Maven way. 我建议使用您的目录之一作为存储库,在其中添加jar,然后以正确的Maven方式加载它。
You can do this adding this to your pom.xml and putting your jar in /lib: 您可以将其添加到pom.xml并将jar放在/ lib中:
<repositories>
<repository>
<id>mylibid</id>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
...
<dependencies>
...
<dependency>
<groupId>com.parse</groupId>
<artifactId>parse</artifactId>
<version>1.9.2</version>
</dependency>
...
</dependencies>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.