Create Android Archive Library(AAR) with maven only

Question!

I am developing a library project which I would like to distribute to other developers.

There have been many discussions on this topic on internet, people suggested to create a distribute version library project which contains only my library project's jar & other resources. It sounds good.

Then, I suddenly found there are people suggested to create Android Archive Library (AAR). But they all uses a tool named Gradle

I am using Eclipse with Maven for my Android library project. My question is, is it possible to generate AAR achieve for my android library project without using Gradle but only with Maven? If so, how?

By : Leem.fin


Answers
The android-maven-plugin allows to package a project as aar-file.

From their documentation https://code.google.com/p/maven-android-plugin/wiki/AAR:

Produce an AAR

If you have a bunch of Java code that you want to share then the best solution is to create a Java project and publish as a plain Java archive (ie jar).

But if you have code plus Android resources that you want to share then you really want to share that as an Android archive (ie AAR). Fortunately this is easy.

Just add configure your project to have packaging aar (and add the android-maven-plugin to build/plugins section of your maven project). Eg

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycoolcompany</groupId>
  <artifactId>general-lib</artifactId>
  <version>1.2.3-SNAPSHOT</version>
  <packaging>aar</packaging>

  ...
</project>
By : Sven


This video can help you solving your question :)
By: admin