android maven打包

pom.xml内容

<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.deppon.app</groupId>  
<artifactId>kaoqin</artifactId>  
<!-- <version>${version}</version> -->  
<version>2.0</version>  
<packaging>apk</packaging>  

<dependencies>  
<dependency>  
<groupId>com.google.android</groupId>  
<artifactId>android</artifactId>  
<version>4.4.2</version>  
</dependency>  
<dependency>  
<groupId>com.google.android</groupId>  
<artifactId>support-v4</artifactId>  
<version>r7</version>  
</dependency>  

<!-- <dependency>  
<groupId>com.deppon.app</groupId>  
<artifactId>depponlib</artifactId>  
<version>1.0</version>  
</dependency>  

<dependency>  
<groupId>com.google.code.gson</groupId>  
<artifactId>gson</artifactId>  
<version>2.2.4</version>  
</dependency> -->  


</dependencies>  


<build>  
<finalName>${project.artifactId}-${complie.profile}-${project.version}</finalName>  
<sourceDirectory>src</sourceDirectory>  
<pluginManagement>  
<plugins>  
<plugin>  
<groupId>org.eclipse.m2e</groupId>  
<artifactId>lifecycle-mapping</artifactId>  
<version>1.0.0</version>  
<configuration>  
<lifecycleMappingMetadata>  
<pluginExecutions>  
<pluginExecution>  
<pluginExecutionFilter>  
<groupId>com.jayway.maven.plugins.android.generation2</groupId>  
<artifactId>android-maven-plugin</artifactId>  
<versionRange>${android.maven.plugin}</versionRange>  
<goals>  
<goal>manifest-update</goal>  
</goals>  
</pluginExecutionFilter>  
<action>  
<ignore />  
</action>  
</pluginExecution>  
</pluginExecutions>  
</lifecycleMappingMetadata>  
</configuration>  
</plugin>  
</plugins>  
</pluginManagement>  
<plugins>  
<plugin>  
<groupId>com.jayway.maven.plugins.android.generation2</groupId>  
<artifactId>android-maven-plugin</artifactId>  
<version>${android.maven.plugin}</version>  
<configuration>  
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>  
<assetsDirectory>${project.basedir}/assets</assetsDirectory>  
<resourceDirectory>${project.basedir}/res</resourceDirectory>  
<!-- <nativeLibrariesDirectory>${project.basedir}/src/native</nativeLibrariesDirectory> -->  
<nativeLibrariesDirectory>${project.basedir}/libs</nativeLibrariesDirectory>  
<sdk>  
<platform>${sdk.platform}</platform>  
</sdk>  
<ndk>  
<path>${android.ndk.path}</path>  
</ndk>  
<emulator>  
<avd>${emulator.avd}</avd>  
</emulator>  
<deleteConflictingFiles>true</deleteConflictingFiles>  
<undeployBeforeDeploy>true</undeployBeforeDeploy>  
<proguardConfig>proguard.cfg</proguardConfig>  
<proguardSkip>${project.build.proguardSkip}</proguardSkip>  
<manifestDebuggable>${manifest.debuggable}</manifestDebuggable>  
<release>${project.build.release}</release>  
<run>  
<debug>${project.build.debug}</debug>  
</run>  
<runDebug>${project.build.runDebug}</runDebug>  
<sign>  
<debug>${project.build.sign.debug}</debug>  
</sign>  
<jvmArguments>  
<jvmArgument>-Xmx1024</jvmArgument>  
</jvmArguments>  
</configuration>  
<extensions>true</extensions>  
<executions>  
<execution>  
<id>run</id>  
<goals>  
<goal>apk</goal>  
<!-- <goal>deploy</goal> <goal>run</goal> -->  
</goals>  
<phase>install</phase>  
</execution>  
<execution>  
<id>update-manifest</id>  
<goals>  
<goal>manifest-update</goal>  
</goals>  
<configuration>  
<manifest>  
<!-- <versionName>123</versionName> <versionCode>123</versionCode> -->  
<!-- <versionCodeAutoIncrement>true</versionCodeAutoIncrement> -->  
<versionCodeUpdateFromVersion>true</versionCodeUpdateFromVersion>  
<!-- <sharedUserId>anId</sharedUserId> <debuggable>true|false</debuggable>  
<supports-screens> <anyDensity>true</anyDensity> <xlargeScreens>false</xlargeScreens>  
</supports-screens> <compatible-screens> <compatible-screen> <screenSize>small</screenSize>  
<screenDensity>ldpi</screenDensity> </compatible-screen> </compatible-screens> -->  
</manifest>  
</configuration>  
</execution>  
</executions>  
</plugin>  
<plugin>  
<groupId>org.apache.maven.plugins</groupId>  
<artifactId>maven-compiler-plugin</artifactId>  
<version>3.1</version>  
<configuration>  
<source>1.6</source>  
<target>1.6</target>  
<encoding>${project.build.sourceEncoding}</encoding>  
<optimize>true</optimize>  
<showWarnings>true</showWarnings>  
<showDeprecation>true</showDeprecation>  
</configuration>  
</plugin>  
</plugins>  
</build>  

<profiles>  
<profile>  
<id>debug</id>  
<activation>  
<activeByDefault>true</activeByDefault>  
</activation>  
<properties>  
<project.build.debug>true</project.build.debug>  
<project.build.runDebug>false</project.build.runDebug>  
<project.build.proguardSkip>true</project.build.proguardSkip>  
<project.build.release>false</project.build.release>  
<project.build.sign.debug>true</project.build.sign.debug>  
<manifest.debuggable>true</manifest.debuggable>  

<complie.profile>debug</complie.profile>  
<android.version>4.4.2</android.version>  
<android.maven.plugin>3.9.0-rc.2</android.maven.plugin>  
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
<!-- <android.sdk.path>E:\DPAP\android\sdk</android.sdk.path> -->  
<android.sdk.path>E:\DPAP\android\sdk</android.sdk.path>  

<!-- <android.sdk.path>/Users/yu/tools/adt-bundle-mac-x86_64-20131030/sdk</android.sdk.path> -->  
<!-- <android.ndk.path>/Users/yu/tools/android-ndk-r9b</android.ndk.path> -->  

<sdk.platform>19</sdk.platform>  
<emulator.avd>nexus4_4.4</emulator.avd>  
<keystore.filename>yuLocal.keystore</keystore.filename>  
<keystore.storepass>123456</keystore.storepass>  
<keystore.keypass>yuLocal</keystore.keypass>  
<keystore.alias>yuLocal</keystore.alias>  
</properties>  
<build>  
<filters>  
<!-- <filter>resources/env-debug.properties</filter> -->  
</filters>  
<plugins>  
<plugin>  
<groupId>org.apache.maven.plugins</groupId>  
<artifactId>maven-jarsigner-plugin</artifactId>  
<version>1.2</version>  
<executions>  
<execution>  
<id>sign</id>  
<goals>  
<goal>sign</goal>  
</goals>  
<phase>package</phase>  
<inherited>true</inherited>  
<configuration>  
<encoding>${project.build.sourceEncoding}</encoding>  
<includes>  
<include>target/${project.build.finalName}.apk</include>  
</includes>  
<removeExistingSignatures>true</removeExistingSignatures>  
<keystore>${keystore.filename}</keystore>  
<storepass>${keystore.storepass}</storepass>  
<keypass>${keystore.keypass}</keypass>  
<alias>${keystore.alias}</alias>  
</configuration>  
</execution>  
</executions>  
</plugin>  
<plugin>  
<groupId>org.codehaus.mojo</groupId>  
<artifactId>exec-maven-plugin</artifactId>  
<version>1.2.1</version>  
<executions>  
<execution>  
<id>zipalign</id>  
<goals>  
<goal>exec</goal>  
</goals>  
<configuration>  
<executable>${android.sdk.path}/tools/zipalign</executable>  
<arguments>  
<argument>-f</argument>  
<argument>4</argument>  
<argument>target/${project.build.finalName}.apk</argument>  
<argument>target/${project.build.finalName}-zipped.apk</argument>  
</arguments>  
</configuration>  
</execution>  
</executions>  
</plugin>  
</plugins>  
</build>  
</profile>  
<profile>  
<id>test</id>  
<!--<activation> <activeByDefault>true</activeByDefault> </activation> -->  
<properties>  
<project.build.debug>false</project.build.debug>  
<project.build.runDebug>false</project.build.runDebug>  
<project.build.proguardSkip>true</project.build.proguardSkip>  
<project.build.release>true</project.build.release>  
<project.build.sign.debug>false</project.build.sign.debug>  
<manifest.debuggable>false</manifest.debuggable>  

<complie.profile>test</complie.profile>  
<android.version>4.4.2</android.version>  
<android.maven.plugin>3.9.0-rc.2</android.maven.plugin>  
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
<!-- <android.sdk.path>/android/sdk/sdk</android.sdk.path> -->  
<android.sdk.path>/android/sdk/adt-bundle-linux-x86_64-20140321/sdk</android.sdk.path>  
<!-- <android.sdk.path>E:/DPAP/android/sdk</android.sdk.path> -->  
<sdk.platform>19</sdk.platform>  
<emulator.avd>nexus4_4.4</emulator.avd>  
<keystore.filename>yuLocal.keystore</keystore.filename>  
<keystore.storepass>123456</keystore.storepass>  
<keystore.keypass>yuLocal</keystore.keypass>  
<keystore.alias>yuLocal</keystore.alias>  
</properties>  
<build>  
<filters>  
<!-- <filter>resources/env-release.properties</filter> -->  
</filters>  
<plugins>  
<plugin>  
<groupId>org.apache.maven.plugins</groupId>  
<artifactId>maven-jarsigner-plugin</artifactId>  
<version>1.2</version>  
<executions>  
<execution>  
<id>sign</id>  
<goals>  
<goal>sign</goal>  
</goals>  
<phase>package</phase>  
<inherited>true</inherited>  
<configuration>  
<encoding>${project.build.sourceEncoding}</encoding>  
<includes>  
<include>target/${project.build.finalName}.apk</include>  
</includes>  
<removeExistingSignatures>true</removeExistingSignatures>  
<keystore>${keystore.filename}</keystore>  
<storepass>${keystore.storepass}</storepass>  
<keypass>${keystore.keypass}</keypass>  
<alias>${keystore.alias}</alias>  
</configuration>  
</execution>  
</executions>  
</plugin>  
<plugin>  
<groupId>org.codehaus.mojo</groupId>  
<artifactId>exec-maven-plugin</artifactId>  
<version>1.2.1</version>  
<executions>  
<execution>  
<id>zipalign</id>  
<goals>  
<goal>exec</goal>  
</goals>  
<phase>package</phase>  
<inherited>true</inherited>  
<configuration>  
<executable>${android.sdk.path}/tools/zipalign</executable>  
<arguments>  
<argument>-f</argument>  
<argument>4</argument>  
<argument>target/${project.build.finalName}.apk</argument>  
<argument>target/${project.build.finalName}-zipped.apk</argument>  
</arguments>  
</configuration>  
</execution>  
</executions>  
</plugin>  
</plugins>  
</build>  
</profile>  
<profile>  
<id>release</id>  
<!--<activation> <activeByDefault>true</activeByDefault> </activation> -->  
<properties>  
<project.build.debug>false</project.build.debug>  
<project.build.runDebug>false</project.build.runDebug>  
<project.build.proguardSkip>true</project.build.proguardSkip>  
<project.build.release>true</project.build.release>  
<project.build.sign.debug>false</project.build.sign.debug>  
<manifest.debuggable>false</manifest.debuggable>  

<complie.profile>release</complie.profile>  
<android.version>4.4.2</android.version>  
<android.maven.plugin>3.9.0-rc.2</android.maven.plugin>  
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
<android.sdk.path>/android/sdk/adt-bundle-linux-x86_64-20140321/sdk</android.sdk.path>  
<!-- <android.sdk.path>E:/DPAP/android/sdk</android.sdk.path> -->  
<sdk.platform>19</sdk.platform>  
<emulator.avd>nexus4_4.4</emulator.avd>  
<keystore.filename>yuLocal.keystore</keystore.filename>  
<keystore.storepass>123456</keystore.storepass>  
<keystore.keypass>yuLocal</keystore.keypass>  
<keystore.alias>yuLocal</keystore.alias>  
</properties>  
<build>  
<filters>  
<!-- <filter>resources/env-release.properties</filter> -->  
</filters>  
<plugins>  
<plugin>  
<groupId>org.apache.maven.plugins</groupId>  
<artifactId>maven-jarsigner-plugin</artifactId>  
<version>1.2</version>  
<executions>  
<execution>  
<id>sign</id>  
<goals>  
<goal>sign</goal>  
</goals>  
<phase>package</phase>  
<inherited>true</inherited>  
<configuration>  
<encoding>${project.build.sourceEncoding}</encoding>  
<includes>  
<include>target/${project.build.finalName}.apk</include>  
</includes>  
<removeExistingSignatures>true</removeExistingSignatures>  
<keystore>${keystore.filename}</keystore>  
<storepass>${keystore.storepass}</storepass>  
<keypass>${keystore.keypass}</keypass>  
<alias>${keystore.alias}</alias>  
</configuration>  
</execution>  
</executions>  
</plugin>  
<plugin>  
<groupId>org.codehaus.mojo</groupId>  
<artifactId>exec-maven-plugin</artifactId>  
<version>1.2.1</version>  
<executions>  
<execution>  
<id>zipalign</id>  
<goals>  
<goal>exec</goal>  
</goals>  
<phase>package</phase>  
<configuration>  
<executable>${android.sdk.path}/tools/zipalign</executable>  
<arguments>  
<argument>-f</argument>  
<argument>4</argument>  
<argument>target/${project.build.finalName}.apk</argument>  
<argument>target/${project.build.finalName}-zipped.apk</argument>  
</arguments>  
</configuration>  
</execution>  
</executions>  
</plugin>  
</plugins>  
</build>  
</profile>  
</profiles>  



</project>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值