maven

Maven and adding JARs to system scope


I have a JAR in my Android project and I want it to be added to final APK. Okay, here I go:

<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>

But when I am running mvn package I am getting a warning:

[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

And in the final APK there are no JARs.

How do I fix that?


Solution

  • You will need to add the jar to your local maven repository. Alternatively (better option) specify the proper repository (if one exists) so it can be automatically downloaded by maven

    In either case, remove the <systemPath> tag from the dependency