Reputation: 5571
I just started converting my Android Project into Maven.
I'm trying to use properties
in my pom.xml but I'm getting the error:
Dependency com.google.android:android${android.version} not found
I'm also getting the same errors for the other properties except for ${junit.version}
.
Below 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>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.myproject.app</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>myapp</module>
<module>mytests</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.6</java.version>
<abs.version>4.2.0</abs.version>
<noa.version>2.4.0</noa.version>
<junit.version>4.8.1</junit.version>
<android.version>4.1.1.4</android.version>
<android-support.version>r12</android-support.version>
<android.sdk.platform>16</android.sdk.platform>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>${android-support.version}</version>
</dependency>
<dependency>
<groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId>
<version>${noa.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<sdk>
<platform>${android.platform}</platform>
</sdk>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.5</version>
<executions>
<execution>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
</execution>
</executions>
<configuration>
<message>Creating site for ${project.version}.</message>
<outputDirectory>website</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
Upvotes: 2
Views: 2460
Reputation: 891
I recommend to create a android maven project with androidKickstartR (http://androidkickstartr.com/) and coppy the pom.xml to your own project where you can edit it to your needs.
When ready build the project with:
mvn clean install android:deploy
Upvotes: 1
Reputation: 10667
It fetched the dependencies just fine for me. I suggest checking a few things:
mvn -X compile
to get more information about which mirrors are being usedsettings.xml
to see which mirrors you are usingUpvotes: 1