我正在尝试pom.xml
为MapChange 项目设置一个。这是相关内容 - 我只是遗漏了一些元信息:
<?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>
我使用Maven Android SDK Deployer 项目安装了 SDK 依赖项。
当我运行$ mvn clean install
maven 时返回以下编译错误。
[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