Question

I am trying to setup a pom.xml for the MapChange project. Here is the relevant content - I just left out some meta-information:

<?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>

  <name>MapChange</name>
  <url>http://github.com/bricolsoftconsulting/MapChange</url>
  <artifactId>mapchange</artifactId>
  <groupId>com.bricolsoftconsulting</groupId>
  <version>0.1.0</version>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <android.version>2.1_r3</android.version>
    <android.version.maps>7_r1</android.version.maps>
  </properties>

  <dependencies>
    <dependency>
      <groupId>android</groupId>
      <artifactId>android</artifactId>
      <version>${android.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.android.maps</groupId>
      <artifactId>maps</artifactId>
      <version>${android.version.maps}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <pluginManagement>
      <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
            </configuration>
          </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
        <artifactId>android-maven-plugin</artifactId>
        <version>3.5.0</version>
      </plugin>
    </plugins>
  </build>

</project>

I installed SDK dependencies using the Maven Android SDK Deployer project.
When I run $ mvn clean install maven returns the following compilation error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: \
        2.3.2:compile (default-compile) on project mapchange: \
        Compilation failure: Compilation failure:
[ERROR] /home/john/dev/MapChange/src/com/bricolsoftconsulting/mapchange/ \
        MyMapActivity.java:[40,18] error: package R does not exist
[ERROR] /home/john/dev/MapChange/src/com/bricolsoftconsulting/mapchange/ \
        MyMapActivity.java:[43,39] error: package R does not exist
Was it helpful?

Solution

I came up with a multi-module Maven project. You can find the current (working) configuration here:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top