maven安装失败

时间:2011-10-25 15:38:16

标签: maven playn

我遵循如何将PlayN与Maven一起使用的指南,但是当我执行命令时:

    maven install 

失败了。

错误日志如下:

    [INFO] 
    [INFO] --- maven-android-plugin:3.0.0-alpha-2:dex (default-dex) @ playn-showcase-android ---
    [INFO] /usr/lib/jvm/java-6-openjdk/jre/bin/java [-Xmx1024m, -jar, /opt/android-sdk/platform-tools/lib/dx.jar, --dex, --output=/home/hox/Projects/playn/playn/sample/showcase/android/target/classes.dex, /home/hox/Projects/playn/playn/sample/showcase/android/target/android-classes]
    [INFO] 
    [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ playn-showcase-android ---
    [INFO] Building jar: /home/hox/Projects/playn/playn/sample/showcase/android/target/playn-showcase-android-1.0-SNAPSHOT.jar
    [INFO] 
    [INFO] --- maven-android-plugin:3.0.0-alpha-2:apk (default-apk) @ playn-showcase-android ---
    [INFO] /opt/android-sdk/platform-tools/aapt [package, -f, -M, /home/hox/Projects/playn/playn/sample/showcase/android/AndroidManifest.xml, -S, /home/hox/Projects/playn/playn/sample/showcase/android/res, --auto-add-overlay, -I, /opt/android-sdk/platforms/android-11/android.jar, -F, /home/hox/Projects/playn/playn/sample/showcase/android/target/playn-showcase-android-1.0-SNAPSHOT.ap_]
    [ERROR] Cannot create the APKBuilder object
    java.lang.NullPointerException
        at com.jayway.maven.plugins.android.phase09package.ApkBuilder.(ApkBuilder.java:195)
        at com.jayway.maven.plugins.android.phase09package.ApkMojo.doAPKWithAPKBuilder(ApkMojo.java:334)
        at com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:249)
        at com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:207)
        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:319)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        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)
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] PlayN Project ..................................... SUCCESS [0.125s]
    [INFO] PlayN Project Archetype ........................... SUCCESS [0.650s]
    [INFO] PlayN Core ........................................ SUCCESS [1.962s]
    [INFO] PlayN JBox2D ...................................... SUCCESS [2.125s]
    [INFO] PlayN WebGL ....................................... SUCCESS [0.914s]
    [INFO] PlayN Java ........................................ SUCCESS [1.740s]
    [INFO] PlayN HTML ........................................ SUCCESS [1.419s]
    [INFO] PlayN Flash ....................................... SUCCESS [1.414s]
    [INFO] PlayN Android ..................................... SUCCESS [1.552s]
    [INFO] PlayN Server ...................................... SUCCESS [0.524s]
    [INFO] PlayN Demos Project ............................... SUCCESS [0.002s]
    [INFO] PlayN Hello Metaproject ........................... SUCCESS [0.003s]
    [INFO] PlayN Hello Core .................................. SUCCESS [0.574s]
    [INFO] PlayN Hello HTML .................................. SUCCESS [18.829s]
    [INFO] PlayN Hello Flash ................................. SUCCESS [22.045s]
    [INFO] PlayN Hello Android ............................... SUCCESS [14.519s]
    [INFO] PlayN Showcase Metaproject ........................ SUCCESS [0.003s]
    [INFO] PlayN Showcase Core ............................... SUCCESS [1.567s]
    [INFO] PlayN Showcase HTML ............................... SUCCESS [21.663s]
    [INFO] PlayN Showcase Flash .............................. SUCCESS [35.783s]
    [INFO] PlayN Showcase Android ............................ FAILURE [11.533s]
    [INFO] PlayN Cute Metaproject ............................ SKIPPED
    [INFO] PlayN Cute Core ................................... SKIPPED
    [INFO] PlayN Cute HTML ................................... SKIPPED
    [INFO] PlayN Cute Flash .................................. SKIPPED
    [INFO] PlayN Cute Android ................................ SKIPPED
    [INFO] PlayN Payments .................................... SKIPPED
    [INFO] PlayN Payments Core ............................... SKIPPED
    [INFO] PlayN Payments Demo Metaproject ................... SKIPPED
    [INFO] PlayN Payments Demo Core .......................... SKIPPED
    [INFO] PlayN payments HTML ............................... SKIPPED
    [INFO] PlayN payments Server ............................. SKIPPED
    [INFO] PlayN Payments Demo HTML .......................... SKIPPED
    [INFO] PlayN Tests Metaproject ........................... SKIPPED
    [INFO] PlayN Benchmark Metaproject ....................... SKIPPED
    [INFO] PlayN Benchmarks Core ............................. SKIPPED
    [INFO] PlayN Benchmark HTML .............................. SKIPPED
    [INFO] PlayN Manual Tests Metaproject .................... SKIPPED
    [INFO] PlayN Manual Tests Core ........................... SKIPPED
    [INFO] PlayN Manual Tests HTML ........................... SKIPPED
    [INFO] PlayN Manual Tests Flash .......................... SKIPPED
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2:20.302s
    [INFO] Finished at: Tue Oct 25 15:44:44 CEST 2011
    [INFO] Final Memory: 122M/318M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:maven-android-plugin:3.0.0-alpha-2:apk (default-apk) on project playn-showcase-android: Cannot create the APKBuilder object: NullPointerException -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    [ERROR] 
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR]   mvn  -rf :playn-showcase-android

我发现了同样的错误here,但没有找到解决方案。

1 个答案:

答案 0 :(得分:4)

您使用的是最近发布的Android SDK的r14吗?看起来它与Playn使用的Maven Android插件的版本有一些问题。尝试使用以下内容替换samples/showcase/android/pom.xml中的插件部分:

<plugins>
  <plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>android-maven-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
      <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
      <assetsDirectory>${project.basedir}/assets</assetsDirectory>
      <resourceDirectory>${project.basedir}/res</resourceDirectory>
      <sdk>
        <platform>11</platform>
      </sdk>
      <undeployBeforeDeploy>true</undeployBeforeDeploy>
      <jvmArguments>
        <jvmArgument>-Xmx1024m</jvmArgument>
      </jvmArguments>
      <dex>
        <jvmArguments>
          <jvmArgument>-Xmx1024m</jvmArgument>
        </jvmArguments>
      </dex>
    </configuration>
    <extensions>true</extensions>
  </plugin>
</plugins>

然后cd进样品/展示并运行mvn clean然后运行mvn。

如果有效,我会在今天晚些时候升级所有样本以使用最新的android maven插件。