1

我是Maven的初学者。请考虑这一点。我想将 Maven 用于我的 Android 项目。为此,我按照以下步骤完成了步骤:

我安装了 Eclipse Helios、Android SDK、ADT-plugin rev 20。我还安装了 Maven 到 Eclipse 插件。我正在使用 Windows 7(32 位)。

这是父 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>

... 安装 Android Maven 集成插件。
但是对于子pom.xml,我遇到了错误。

子 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>
4

1 回答 1

0

我的 pom.xml 在一个 maven android 项目中。它工作正常:

<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>
于 2013-02-15T11:47:30.873 回答