I'm posting the way I did it for now, in case someone is looking for the same solution.
Note that the code is not clean and not portable.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-aidl</id>
<phase>generate-sources</phase>
<configuration>
<target name="convert-aidl-files">
<property name="aidl" location="${env.ANDROID_HOME}/build-tools/android-4.2.2/aidl${exe}"/>
<property name="framework.aidl" location="${env.ANDROID_HOME}/platforms/android-17/framework.aidl"/>
<apply executable="${aidl}" parallel="false">
<arg value="-I${src.dir}"/>
<arg value="-p${framework.aidl}"/>
<arg value="-o${gen.dir}"/>
<srcfile/>
<fileset dir="${src.dir}">
<include name="**\*.aidl"/>
</fileset>
</apply>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
- The
maven-antrun-plugin
is maven plugin to execute ant tasks. - The property
aidl
is pointing to the aidl.exe from Android SDK build-tools. This part of the script is using hard-coded values. The better way will be to discover the location dynamically, but unfortunately I've not found the way to do it yet. - The property
framework.aidl
is pointing to the framework.aidl file from Android SDK. This part of the script is using hard-coded values. The better way will be to discover the location dynamically, but unfortunately I've not found the way to do it yet. - The
apply
ant task is used to execute the aidl.exe withfileset
as input argument. - The
srcfile
is used to mention the input files for theapply
task. Thesrcfile
is empty, but I've used thefileset
below to filter only the files with *.aidl extension.