一、签名
1.在文件pom.xml添加一下内容
<?xml version="1.0" encoding="UTF-8"?>
<projectxmlns="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/maven-v4_0_0.xsd">
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version> 4.1.1.4
</platform.version>
<annotations.version>4.1.1.4</annotations.version>
<android.plugin.version>4.0.0-rc.2</android.plugin.version>
<keystore.filename>keystore/android-demo.keystore</keystore.filename>
<keystore.storepass>demo2015</keystore.storepass>
<keystore.keypass>demo2015</keystore.keypass>
<keystore.alias>android-demo.keystore</keystore.alias>
</properties>
<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>
<includes>
<include>${project.build.outputDirectory}/*.apk</include>
</includes>
<!-- 移除已存在的签名(android debug的签名) -->
<removeExistingSignatures>true</removeExistingSignatures>
<keystore>${keystore.filename}</keystore>
<storepass>${keystore.storepass}</storepass>
<keypass>${keystore.keypass}</keypass>
<alias>${keystore.alias}</alias>
</configuration>
</execution>
</executions>
</plugin>
2.打包自动传递到ftp服务器配置,在pox.xml添加一下内容
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0-beta-4</version>
<executions>
<execution>
<id>upload_apk</id>
<phase>deploy</phase>
<goals>
<goal>upload-single</goal>
</goals>
<configuration>
<serverId>ftp-repository</serverId>
<url>ftp://demo.de.com:2690/ftproot/update/app/android/demo</url>
<fromFile>${basedir}/target/${project.artifactId}-${manifest.metadata.id}-${project.version}.apk</fromFile>
<toFile>${project.name}_${project.version}_${app.channel}.apk</toFile>
</configuration>
</execution>
</executions>
</plugin>
3.多渠道打包,在pox.xml添加一下内容
<!-- 渠道profiles -->
<profile>
<id>channel-test</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<manifest.metadata.id>test</manifest.metadata.id>
<manifest.metadata.channel>test market</manifest.metadata.channel>
</properties>
</profile>
<profile>
<id>channel-baidu</id>
<properties>
<manifest.metadata.id>baidu</manifest.metadata.id>
<manifest.metadata.channel>baidu</manifest.metadata.channel>
</properties>
</profile>
3.pom.xml文件如下如下:
<?xml version="1.0" encoding="UTF-8"?>
<projectxmlns="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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.special.demo</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>dem