1

我正在尝试使用 Maven 构建我的应用程序。我的应用中有 3 个项目,2 个库项目和 1 个主项目。我正在使用 4.2.2 版本的 android.因为 maven 存储库中没有 4.2.2 版本的可用依赖项,所以我已手动将 android.jar 文件安装到我的本地存储库。当我尝试构建我的项目时,我在主项目上遇到错误。2 个库项目和父 pom 文件正在正确构建。

  [ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException:
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:478)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:193)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "D:\Android\android-sdk\platf
  orm-tools\aapt.exe package -m -J D:\Development\Android\1.Projects\SAFE-0460-01-00\SafewayWorkspace\maven\3.2_rc\Safeway\target\generated-sources\r -M D:
    \Development\Android\1.Projects\SAFE-0460-01-  00\SafewayWorkspace\maven\3.2_rc\Safeway\AndroidManifest.xml -S   D:\Development\Android\1.Projects\SAFE-0460-
01-00\SafewayWorkspace\maven\3.2_rc\Safeway\res -S D:\Development\Android\1.Projects\SAFE-0460-01-00\SafewayWorkspace\maven\3.2_rc\Safeway\target\unpack\
   apklibs/com.safeway.justforu_android-mapviewballoons_apklib_1.0.0-SNAPSHOT/res -S D:\Development\Android\1.Projects\SAFE-0460-01-00\SafewayWorkspace\mave
 n\3.2_rc\Safeway\target\unpack\apklibs/com.safeway.justforu_AndroidClient_apklib_1.0.0-SNAPSHOT/res --auto-add-overlay -A D:\Development\Android\1.Projec
 ts\SAFE-0460-01-00\SafewayWorkspace\maven\3.2_rc\Safeway\assets -I D:\Android\android-sdk\platforms\android-17\android.jar", Result = 1
    at  com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(CommandExecutor.j  va:339)
      at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:474)
    ... 22 more

这是我的主要项目 POM 文件。

        <?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>com.app.pack</groupId>
    <artifactId>libraryprojects-parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.app.pack</groupId>
<artifactId>MainProj</artifactId>
<packaging>apk</packaging>
<name>MainProj</name> 

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <scope>provided</scope>
    </dependency>
     <dependency>
           <groupId>com.google.android.support-v4</groupId>
           <artifactId>android-support-v4</artifactId>
           <version>r6-googlemaps</version>
           <scope>compile</scope>
         </dependency>
     <dependency>
         <groupId>com.google.amazon.maps</groupId>
         <artifactId>maps</artifactId>
          <version>1.0.2</version>
         <scope>provided</scope>
       </dependency>
     <dependency>
         <groupId>com.google.android.maps</groupId>
         <artifactId>maps</artifactId>
          <version>17_r1</version>
           <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.lib.proj1</groupId>
        <artifactId>libproj1</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <type>apklib</type> 
    </dependency>
    <dependency>
        <groupId>com.lib.proj2</groupId>
        <artifactId>libproj2</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <type>apklib</type> 
    </dependency>   
 <dependency>
        <groupId>com.google.android.ensighten</groupId>
        <artifactId>Ensighten</artifactId>
        <version>1.0</version>
        <type>jar</type> 
    </dependency> 
    <dependency>
        <groupId>com.google.android.ensighten</groupId>
        <artifactId>EnsightenAspect</artifactId>
        <version>1.0</version>
        <type>jar</type> 
    </dependency>   
   <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.0</version>
        <type>jar</type> 
    </dependency>   
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android-async-http</artifactId>
        <version>1.4.3</version>
        <type>jar</type> 
    </dependency>       
</dependencies>
<build>
    <sourceDirectory>src</sourceDirectory>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <extensions>true</extensions>
        </plugin>
        </plugins>
</build>

这是我的父 POM 文件

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.app.pack libraryprojects-parent 1.0.0-SNAPSHOT pom Library Projects Parent

com.google.android 安卓 4.2.2 com.google.android 安卓测试 4.1.1.4

  </dependencies>
</dependencyManagement>

<build>
    <pluginManagement> 
        <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
           <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin> 
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.5.1</version>

                <configuration>
                    <sdk>
                        <platform>17</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
            </plugin>

        </plugins>
    </pluginManagement>
</build>

4

0 回答 0