Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
Maven: The Complete Reference
The Android Maven plugin customizes the lifecycle based on the
packaging. If your project has a packaging of type+apk+ the Android
plugin will execute a customized lifecycle.
The customised life cycle has the following additional executions in the default lifecycle.
- generate-sources Phase
-
Use the Android Asset Packaging Tool (
aapt) of the platform version specified in the pom to package the Android specific resources likeAndroidManifest.xml, assets and resources. - process-classes Phase
-
Run the
dxtool of the platform version specified in the pom to convert all classes (libraries, resources and project code) into davlik executable format. - package Phase
-
Run the Android Package tool (
apk) of the Android SDK to create and sign the Android package file (apk) for installation on the emulator or device. - pre-integration-test Phase
-
Deploy the currently built Android application package (apk) as
well as any other dependencies with
packagingtypeapkto the emulator/device. - integration-test Phase
- Run the instrumentation test classes against the deployed application.
The Maven Android Plugin contains the following goals:
- android:apk
-
The
apkgoal creates the android package (apk) file. By default the plugin signs the file with the debug keystore. The configuration parameter can be used to disable the signing process.
<sign><debug>false<debug><sign>
- android:deploy
-
The
deploygoal deploys the built apk file, or another specified apk, to a connected device or emulator. This goal is automatically performed when running through theintegration-testlifecycle phase on a project with instrumentation tests (e.g.mvn installormvn integration-test). - android:deploy-dependencies
-
The
deploy-dependenciesgoal deploys all directly declared dependencies of<type>apk</type>in this project. This goal is usually used in a project with instrumentation tests, to deploy the apk to test onto the device before running the deploying and running the instrumentation tests apk. The goal is automatically performed when running through the integration-test life cycle phase on a project with instrumentation tests (e.g.mvn installormvn integration-test). - android:dex
-
The
dexgoal converts compiled Java classes to the Android Dalivk Executable (dex) format. - android:emulator-start
-
The
emulator-startgoal starts the Android device emulator. The start up parameters can be configured in the Maven Android Plugin configuration in the pom.xml file
<configuration>
...
<emulator>
<avd>21</avd>
<wait>6000</wait>
<options>-no-skin</options>
</emulator>
...
</configuration>
or via command line parameters outside an actual project.
mvn android:emulator-start \ -Dandroid.emulator.avd=Default \ -Dandroid.emulator.options=-no-skin \ -Dandroid.emulator.wait=10000
- android:emulator-stop
-
The
emulator-stopsstops the Android device emulator and can be used inside or outside a Maven project folder. - android:generate-sources
-
The
generate-sourcesgoal generatesR.javabased on the resources specified by the resources configuration parameter. It generates Java files based on aidl files. If the configuration parameterdeleteConflictingFilesis true (which it is by default), this goal has also deletes any R.java files found in the source directory, deletes any .java files with the same name as an .aidl file found in the source directory and deletes any Thumbs.db files found in the resource directory. - android:instrument
-
The
instrumentgoal runs the instrumentation android package on the device/emulator. - android:internal-integration-test
-
The
internal-integration-testgoal is called automatically when the lifecycle reaches theintegration-testphase. It determines whether to call the goal instrument in this phase based on the existence of instrumentation test classes in the current project. The goal is internal to the plugin lifecycle and should not be used as separate invocation on the command line. - android:internal-pre-integration-test
-
The
internal-pre-integration-testgoal is called automatically when the lifecycle reachespre-integration-testphase. It determines whether to call the goalsandroid:deploy-dependenciesandandroid:deployin this phase and if necessary invokes them. The goal is internal to the plugin lifecycle and should not be used as separate invocation on the command line. - android:pull
- The pull goal can be used to copy files or directories from the device.
- android:push
- The pull goal can be used to copy files or directories to the device.
- android:undeploy
- The undeploy goal removes the apk of the current project, or another specified apk, from the connected device.
Copyright © 2008-2011, Sonatype Inc. All rights reserved. Includes the third-party code listed here. Sonatype and Sonatype Nexus are trademarks of Sonatype, Inc. Apache Maven and Maven are trademarks of the Apache Software Foundation. M2Eclipse is a trademark of the Eclipse Foundation. All other trademarks are the property of their respective owners.
Copyright © 2008-2011, Sonatype Inc. All rights reserved. Includes the third-party code listed here. Sonatype and Sonatype Nexus are trademarks of Sonatype, Inc. Apache Maven and Maven are trademarks of the Apache Software Foundation. M2Eclipse is a trademark of the Eclipse Foundation. All other trademarks are the property of their respective owners.
Copyright © 2008-2011, Sonatype Inc. All rights reserved. Includes the third-party code listed here. Sonatype and Sonatype Nexus are trademarks of Sonatype, Inc. Apache Maven and Maven are trademarks of the Apache Software Foundation. M2Eclipse is a trademark of the Eclipse Foundation. All other trademarks are the property of their respective owners.
Copyright © 2008-2011, Sonatype Inc. All rights reserved. Includes the third-party code listed here. Sonatype and Sonatype Nexus are trademarks of Sonatype, Inc. Apache Maven and Maven are trademarks of the Apache Software Foundation. M2Eclipse is a trademark of the Eclipse Foundation. All other trademarks are the property of their respective owners.