可用的Goals

Goal描述
android:apk 创建apk文件。默认使用debug密钥对Apk签名。
如需修改可以修改配置参数为<sign><debug>false</debug></sign>
android:apklib 创建apklib文件。apklib文件并不会被部署。
android:deploy 部署编译好或指定的apk文件到一个连接的设备上。在运行mvn integration-test(或mvn install)命令会自动执行。
android:deploy-dependencies Deploys all directly declared dependencies of <type>apk</type> in this project's pom.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.Automatically performed when running mvn integration-test (or mvn install) on a project with instrumentation tests.
android:dex 将编译好的Java classes转换为Android dex格式。
android:emulator-start 启动指定的Android模拟器。
android:emulator-stop 停止指定的Android模拟器.
android:generate-sources Generates R.java based on resources specified by the resources configuration parameter.Generates java files based on aidl files.
If the configuration parameter deleteConflictingFiles is true (which it is by default), this goal has the following side-effects:
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.
deletes any Thumbs.db files found in the resource directory.
android:instrument 在设备运行apk程序.
android:internal-integration-test 内部命令,不要直接使用。生命周期到达integration-test步骤时会自动调用。
android:ndk-build 未知
android:pull 从设备上复制文件/文件夹。
android:push 拷贝文件/文件夹到设备上。
android:redeploy 在连接的设备上重新部署编译或指定的apk文件。
android:undeploy 从连接的设备上卸载生成或指定的apk文件。
android:unpack 解包库。
android:version-update 更新AndroidManifest.xml文件中版本信息相关内容。可以使android:versionName属性值和工程的版本信息保持一致。也可以配置使android:versionCode自动增长。
注意:该操作可能会重新格式化AndroidManifest.xml文件内容。

配置自动更新android:versionName:
  <plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>maven-android-plugin</artifactId>
    <executions>
      <execution>
        <id>update-version</id>
        <goals>
          <goal>version-update</goal>
        </goals>
        <configuration>
          <versionNameUpdate>true</versionNameUpdate>
        </configuration>
      </execution>
    </executions>
  </plugin>

配置android:versionCode自动增长:

  <plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>maven-android-plugin</artifactId>
    <executions>
      <execution>
        <id>update-version</id>
        <goals>
          <goal>version-update</goal>
        </goals>
        <configuration>
          <versionCodeAutoIncrement>true</versionCodeAutoIncrement>
        </configuration>
      </execution>
    </executions>
  </plugin>
android:zipalign ZipalignMojo can run the zipalign command against the apk.
posted on 2011-10-25 10:43  情定诺坎普  阅读(2907)  评论(0编辑  收藏  举报