Android Maven Plugin does not work - android

I´m trying to run the android greenhouse client with the android maven plugin and I got the following execption while trying to execute mvn clean install:
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:maven-android-plugin:2.8.4:dex (default-dex) on project greenhouse: MojoExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C ""C:\Dokumente und Einstellungen\lyth\Eigene Dateien\Downloads\android-sdk_r11-windows\android-sdk-windows\platform-tools\dx.bat" --dex "--output=C:\Dokumente und Einstellungen\lyth\Eigene Dateien\Downloads\SpringSource-greenhouse-android-feff5a5\target\classes.dex" "C:\Dokumente und Einstellungen\lyth\Eigene Dateien\Downloads\SpringSource-greenhouse-android-feff5a5\target\android-classes"", Result = 255
My pom.xml looks like this:
<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.springsource</groupId>
<artifactId>greenhouse</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<packaging>apk</packaging>
<name>greenhouse-android</name>
<url>http://www.springsource.org</url>
<organization>
<name>SpringSource</name>
<url>http://www.springsource.org</url>
</organization>
<properties>
<env>dev</env>
<android-platform>7</android-platform>
<android-emulator>7</android-emulator>
<maven-resources-plugin-version>2.5</maven-resources-plugin-version>
<maven-android-plugin-version>2.8.4</maven-android-plugin-version>
<maven-compiler-plugin-version>2.3.2</maven-compiler-plugin-version>
<maven-eclipse-plugin-version>2.8</maven-eclipse-plugin-version>
<android-version>2.1_r1</android-version>
<java-version>1.6</java-version>
<spring-android-version>1.0.0.M4</spring-android-version>
<spring-social-version>1.0.0.RC1</spring-social-version>
<spring-security-version>3.1.0.RC2.crypto</spring-security-version>
<jackson-version>1.8.3</jackson-version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.android</groupId>
<artifactId>spring-android-auth</artifactId>
<version>${spring-android-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
<version>${spring-security-version}</version>
<exclusions>
<!-- exclude in favor of spring-android-core -->
<exclusion>
<artifactId>spring-core</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
<version>${spring-social-version}</version>
<exclusions>
<!-- exclude in favor of spring-android-rest-template -->
<exclusion>
<artifactId>spring-web</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson-version}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<filters>
<filter>${project.basedir}/filters/${env}.properties</filter>
</filters>
<resources>
<!-- copy and filter all xml resource files -->
<resource>
<directory>${project.basedir}/res</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/filtered-res</targetPath>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<!-- copy only. do not filter non-xml resource files -->
<resource>
<directory>${project.basedir}/res</directory>
<filtering>false</filtering>
<targetPath>${project.build.directory}/filtered-res</targetPath>
<excludes>
<exclude>**/*.xml</exclude>
</excludes>
</resource>
<!-- copy and filter the Android Manifest file -->
<resource>
<directory>${project.basedir}</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/filtered-manifest</targetPath>
<includes>
<include>AndroidManifest.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin-version}</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<version>${maven-android-plugin-version}</version>
<configuration>
<androidManifestFile>${project.build.directory}/filtered-manifest/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.build.directory}/filtered-res</resourceDirectory>
<sdk>
<platform>${android-platform}</platform>
</sdk>
<emulator>
<avd>${android-emulator}</avd>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin-version}</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
</profile>
</profiles>
<repositories>
<!-- For testing against latest Spring snapshots -->
<repository>
<id>org.springframework.maven.snapshot</id>
<name>Spring Maven Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- For developing against latest Spring milestones -->
<repository>
<id>org.springframework.maven.milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Does anybody know how to fix this problem?

Answered in comments:
okay .. problem solved .. it was because of the whitespaces in the
path .. – Christine Bauers Aug 11 '11

Related

How to use profiles with Maven and Android properly?

My target is to use two different profiles for different deployment phases (development, release), since release has for example debug flag to false while development has debug flag to true. When I build without profiles, it works without problems. But when I put the build section into a profile, Eclipse complains with the following message: "Project build error: Unknown packaging: apk", although the build itself works.
My questions are:
How can I get rid of the error message when using profiles (there are
also solutions at SO which work, but not when using profiles).
Is it possible to configure a common configuration build base for two profiles while "overriding" some configs in the profile itself? For example profile one has <debug>true</debug> and profile two has <debug>false</debug> or do I have to write the whole build section in both profiles?
Here is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mydomain</groupId>
<artifactId>myartifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>My App</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version>4.4.2</platform.version>
<android.version>19</android.version>
<android.plugin.version>3.8.2</android.plugin.version>
<java.version>1.6</java.version>
<android.sdk.path>/opt/android-sdk-linux</android.sdk.path>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<junit.version>4.8.2</junit.version>
<mockito.version>1.9.5</mockito.version>
<jackson.version>1.9.13</jackson.version>
<hamcrest.version>1.3</hamcrest.version>
<annotations.version>4.1.1.4</annotations.version>
<supportv4.version>r13</supportv4.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${platform.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>${supportv4.version}</version>
</dependency>
<dependency>
<groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId>
<version>2.4.0</version>
</dependency>
<!-- LInt Annotations -->
<dependency>
<groupId>com.google.android</groupId>
<artifactId>annotations</artifactId>
<version>${annotations.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- Non Android Tests --><!-- hamcrest must be before JUnit due to build errors -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>devel</id>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>${android.version}</platform>
<path>${android.sdk.path}</path>
</sdk>
<undeployBeforeDeploy>false</undeployBeforeDeploy>
<sign>
<debug>true</debug>
</sign>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I think this is what you are looking for:
<profiles>
<profile>
<id>development</id>
<properties>
<debug>true</debug>
</properties>
</profile>
<profile>
<id>release</id>
<properties>
<debug>false</debug>
</properties>
</profile>
</profiles>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>${android.version}</platform>
<path>${android.sdk.path}</path>
</sdk>
<undeployBeforeDeploy>false</undeployBeforeDeploy>
<sign>
<debug>${debug}</debug>
</sign>
</configuration>
</plugin>
</plugins>
</build>
This way you have one common build tag and two profiles, each profile specified whether to debug or not via the properties tag. Then when building you specify your profile like this: -Pdevelopment or -Prelease. Hope it helps.

maven android plugin with error ( dependency=[android.support:compatibility-v7:apklib:19:compile] not found )

I am using maven 3.1.1. with Eclipse Kepler installed with Android-Configurator-for-M2E.
My POM.XML looks like:
<?xml version="1.0" encoding="UTF-8"?>
<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.company.sample</groupId>
<artifactId>SampleApplication</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>SampleApplication</name>
<description>A sample application to demo clean android code.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version>2.3.1</platform.version>
<android.plugin.version>3.6.0</android.plugin.version>
</properties>
<dependencies>
<!-- android SDK -->
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<!-- support-v4 -->
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>19.0.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- v7-extra -->
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7</artifactId>
<version>19</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7</artifactId>
<version>19</version>
<type>jar</type>
</dependency>
<!-- v7-appcompat -->
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>19</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>19</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.6.0</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>18</platform>
</sdk>
<action>
<ignore></ignore>
</action>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>18</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>allow-snapshots</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</project>
The command: mvn clean install, builds successfully, but refreshing the project in eclipse gives this error:
dependency=[android.support:compatibility-v7:apklib:19:compile] not found in workspace pom.xml /SampleApplication line 1 me.gladwell.eclipse.m2e.android.markers.dependency.apklib
Fixed this problem by downloading a new copy of eclipse 4.3.1 and re-installed the following:
ADT pluugin
M2E
M2E-Android
Then imported the same project which built fine with: mvn clean install.
Then removed all the Libraries from the build path and did: Android-Tools>Fix Project Properties.

maven-android-plugin and Android Test Project give INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES

I am trying to use the maven-android-plugin to launch InstrumentationTestRunner tests.
I created an App com.my.app.
I created a simple Android Test Project com.my.app.test2.
I made maven use the jarsigner to automatically sign the apks.
For sining I am using the same KeyStore.
Anyway I am getting the following error, when I try to execute the test project by doing maven clean install
Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:internal-pre-integration-test (default-internal-pre-integration-test) on project eticapptest2: 42f7a71e823ebff9_samsung_GT-N7105 : Install of D:\AndroidApp\com.my.app.test2\target\eticapptest2-1.0.0-SNAPSHOT.apk failed - [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES
What I tried:
When I inspect the APKs which are produced and signed during the maven run - I see, that both (the com.my.app.apk and com.my.app.test2.apk) are signed correctly.
The certificates are the same.
What could be the reason for the error?
My com.my.app POM
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.my.app.apps</groupId>
<artifactId>root</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
<deivukeypass>APP_PASS_HERE</deivukeypass>
</properties>
<artifactId>eticapp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>eTicApp</name>
<dependencies>
<!-- Basic Android API + Compatibility -->
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.2.2_r2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v13</artifactId>
<version>18</version>
</dependency>
<!-- NeoReaderSDK (Barcode-Scanner) -->
<dependency>
<groupId>com.my.app.apps</groupId>
<artifactId>neoreadersdk</artifactId>
<version>${project.version}</version>
<type>apklib</type>
</dependency>
<!-- ADAC/Postbus-Ticket-Records und -Decoder -->
<dependency>
<groupId>com.my.app</groupId>
<artifactId>common-barcode-android</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- Implementierung fur Logging (slf4j) -->
<!-- diese impl macht probleme und funktioniert zur zeit nicht??
Auskommentiert um den Fehler ersteinmal loszuwerden!
<dependency>
<groupId>com.github.tony19</groupId>
<artifactId>logback-android-classic</artifactId>
<version>1.0.10-2</version>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
</exclusion>
</exclusions>
</dependency> -->
<!-- ORMlite fur Android -->
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-android</artifactId>
<version>4.46</version>
<exclusions>
<!-- Android-Artefakte haben bei uns andere Koordinaten -->
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JSonPath is like xpath xml, but for JSON -->
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>0.8.1</version>
</dependency>
</dependencies>
<build>
<!-- Android-Standard-Verzeichnisstruktur verwenden -->
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- Maven plugin which is responsible for signing apks -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
<goal>verify</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory/>
<includes>
<include>${project.build.finalName}</include>
</includes>
<keystore>${basedir}/local/AndroidDeveloperCertificate.jks</keystore>
<alias>adtkey</alias>
<storepass>${deivukeypass}</storepass>
<keypass>${deivukeypass}</keypass>
<verbose>true</verbose>
<arguments>
<argument>-sigalg</argument><argument>MD5withRSA</argument>
<argument>-digestalg</argument><argument>SHA1</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- Maven-Android-Plugin konfigurieren -->
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>4.2.2</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk> <!-- target/eticapp-1.0.0-SNAPSHOT.apk -->
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
</zipalign>
</configuration>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Profil fur Release-Versionen zum Setzen der Version -->
<id>setVisualVersion</id>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<manifest>
<versionName>${env.IVU-VERSION-MAJOR}.${env.IVU-VERSION-MINOR}.${env.IVU-VERSION-REVISION} ${env.IVU-VERSION-BUILD} Build-${buildNumber}</versionName>
<versionCode>${buildNumber}</versionCode>
</manifest>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
My com.my.app.test2 POM
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.my.app.apps</groupId>
<artifactId>root</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>eticapptest2</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>eTicApp - Test</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>4.1.1.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.my.app.apps</groupId>
<artifactId>eticapp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>apk</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.my.app.apps</groupId>
<artifactId>eticapp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<!-- Android-Standard-Verzeichnisstruktur verwenden -->
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- Maven-Android-Plugin konfigurieren -->
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>4.2.2</platform>
</sdk>
<undeployBeforeDeploy>false</undeployBeforeDeploy>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk> <!-- target/eticapp-1.0.0-SNAPSHOT.apk -->
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
</zipalign>
</configuration>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Maven plugin which is responsible for signing apks -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
<goal>verify</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory/>
<includes>
<include>${project.build.finalName}</include>
</includes>
<keystore>${basedir}/local/AndroidDeveloperCertificate.jks</keystore>
<alias>adtkey</alias>
<storepass>APP_PASS_HERE</storepass>
<keypass>APP_PASS_HERE</keypass>
<verbose>true</verbose>
<arguments>
<argument>-sigalg</argument><argument>MD5withRSA</argument>
<argument>-digestalg</argument><argument>SHA1</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES
The error indicates you have a version of the app installed with a different certificate.
Before running mvn clean install, uninstall both the apps:
adb uninstall com.my.app
adb uninstall com.my.app.test2

maven android pom.xml

I have set up my an in house nexus repository. Now i have changed my settings.xml file to point to my repository, but i also want to include the reference in my project pom.xml file. Now is this pom.xml file valid ? If i change the password of the repo, maven still downloads the file from the repo ? What am i doing wrong ? Is this configuration correct ?
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycomp</groupId>
<artifactId>TestAndroid</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>Test Android Application</name>
<servers>
<server>
<id>com-repo</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
<repositories>
<repository>
<id>com-repo</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>com-repo</id>
<name>com-repo</name>
<url>http://10.10.10.230:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.springframework.android</groupId>
<artifactId>spring-android-rest-template</artifactId>
<version>1.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.8</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>20030203.000129</version>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.2.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>org.google</groupId>
<artifactId>admob</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.mycpmp</groupId>
<artifactId>1234</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.taptwo.android</groupId>
<artifactId>widget</artifactId>
<version>1.0.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.google.api-ads</groupId> -->
<!-- <artifactId>dfp-lib</artifactId> -->
<!-- <version>0.4.0</version> -->
<!-- </dependency> -->
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.1.1</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<attachSources>true</attachSources>
<sign>
<debug>false</debug>
</sign>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<archiveDirectory></archiveDirectory>
<includes>
<include>target/*.apk</include>
</includes>
<keystore>avm.keystore</keystore>
<storepass>123</storepass>
<keypass>123</keypass>
<alias>asdfg</alias>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Your pom is not valid.
As stated in here, you should not put the username and password in the pom.xml.
The repositories for download and deployment are defined by the repositories and distributionManagement elements of the POM. However, certain settings such as username and password should not be distributed along with the pom.xml. This type of information should exist on the build server in the settings.xml.
The credentials are only for deploying to the repository. Repositories for deployment are defined in a distributionManagement element; it's distinct from the repositories element stuff. The repositories element defines repos where your dependencies are resolved from.
Moreover, the pom doesn't support putting the credentials in like this. Are you getting errors when you execute it? I would think so.

Maven Android integration error

I am beginner in Maven. Please consider this.
I want to use Maven for my Android project. For that I have done steps as per:
http://rgladwell.github.com/m2e-android/
and
http://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/wiki/GettingStarted
I have Eclipse Helios, Android SDK, ADT-plugin rev 20 installed. Also I installed maven to eclipse plugin.
I am using Windows 7 (32 bit).
Here is the parent Pom.xml:
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<sdk>
<platform>15</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
... which installs Android Maven integration plugins.
But with the child pom.xml I am getting errors.
child 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>GROUPID</groupId>
<artifactId>CHILDID</artifactId>
<version>1.0</version>
<packaging>apklib</packaging>
<parent> <!-- getting error here --->
<groupId>GROUPID</groupId>
<artifactId>ARTIID</artifactId>
<version>1.0</version>
<relativePath>..</relativePath>
</parent>
......
......
<plugins>
<plugin>
<artifactId>ID</artifactId>
<version>1.1</version>
<executions>
<execution>
<!-- getting error here --->
</execution>
</plugin>
</plugins>
My pom.xml in a maven android project. It works fine:
<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>empresa</groupId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<artifactId>maestro-empresas</artifactId>
<packaging>apk</packaging>
<name>maestro-empresas</name>
<properties>
<maven-android-plugin-version>3.0.0-alpha-13</maven-android-plugin-version>
<maven-compiler-plugin-version>2.3.2</maven-compiler-plugin-version>
<com.google.android-version>2.2.1</com.google.android-version>
<org.springframework.android-version>1.0.0.BUILD-SNAPSHOT</org.springframework.android-version>
<commons-httpclient-version>3.1</commons-httpclient-version>
<org.codehaus.jackson-version>1.8.8</org.codehaus.jackson-version>
<android-platform>8</android-platform>
</properties>
<pluginRepositories>
<pluginRepository>
<id>oss.sonatype.org-jayway-snapshots</id>
<name>Jayway OpenSource SNAPSHOTs on Sonatype.org</name>
<url>http://oss.sonatype.org/content/repositories/jayway-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src</sourceDirectory>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${maven-android-plugin-version}</version>
<configuration>
<sdk>
<!-- D:/SW/android-sdks/ -->
<!-- <path>${android.home}</path> -->
<platform>${android-platform}</platform>
</sdk>
<emulator>
<avd>Android2.2</avd>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin-version}</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${com.google.android-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.android</groupId>
<artifactId>spring-android-rest-template</artifactId>
<version>${org.springframework.android-version}</version>
</dependency>
<dependency>
<!-- Para json -->
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${org.codehaus.jackson-version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>org.springframework.maven.snapshot</id>
<name>Spring Maven Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>org.springframework.maven.milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>android-rome-feed-reader-repository</id>
<name>Android ROME Feed Reader Repository</name>
<url>https://android-rome-feed-reader.googlecode.com/svn/maven2/releases</url>
</repository>
</repositories>
</project>

Categories

Resources