简体   繁体   中英

Maven: NoClassDefFoundError of system scoped dependency

I am developing an Android project with Maven. I have a third-party jar file that I have included in a lib folder on my project root directory:

 <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 . Obviously, that class exists inside the 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.

You can do this adding this to your pom.xml and putting your jar in /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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM