Android-Maven 安装时无法执行目标 org.codehaus.mojoto

标签 android maven maven-2 development-environment android-maven-plugin

我正在使用新的 Android ADT Bundle 和 Android-Mavem Deployer 来设置新的 Android-Maven 开发。

$ANDROID_HOME/Users/allanhahaha/Documents/adt-bundle-mac-x86_64-20130917/sdk

当我在 maven-android-sdk-deployer-master 文件夹中运行 mvn clean install -X 时,出现以下错误:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.966s
[INFO] Finished at: Sat Oct 12 20:34:27 PDT 2013
[INFO] Final Memory: 11M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default) on project android-3: Properties file not found: /Users/allanhahaha/Documents/adt-bundle-mac-x86_64-20130917/sdk/platforms/android-3/source.properties -> [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 <goals> -rf :android-3

这里有一些额外的错误消息:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default) on project android-3: Properties file not found: /Users/allanhahaha/Documents/adt-bundle-mac-x86_64-20130917/sdk/platforms/android-3/source.properties

这对我来说看起来很奇怪,因为我什至没有 android-3 文件夹:

ALLAN-MacBook-Pro:platforms allanhahaha$ pwd
/Users/allanhahaha/Documents/adt-bundle-mac-x86_64-20130917/sdk/platforms
ALLAN-MacBook-Pro:platforms allanhahaha$ ls -l
total 0
drwxr-xr-x  11 allanhahaha  staff  374 Oct 12 18:15 android-10
drwxr-xr-x  12 allanhahaha  staff  408 Oct 12 18:14 android-11
drwxr-xr-x  12 allanhahaha  staff  408 Oct 12 18:13 android-12
drwxr-xr-x  12 allanhahaha  staff  408 Oct 12 18:12 android-13
drwxr-xr-x  10 allanhahaha  staff  340 Oct 12 18:10 android-14
drwxr-xr-x  10 allanhahaha  staff  340 Oct 12 18:10 android-15
drwxr-xr-x  11 allanhahaha  staff  374 Oct 12 18:10 android-16
drwxr-xr-x  11 allanhahaha  staff  374 Oct 12 18:09 android-17
drwxrwx---@ 11 allanhahaha  staff  374 Sep 10 11:56 android-18
drwxr-xr-x  11 allanhahaha  staff  374 Oct 12 18:16 android-8

这是我的 POM.xml 配置的一部分:

<build>
<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>properties-maven-plugin</artifactId>
      <version>1.0-alpha-2</version>
    </plugin>
    <plugin>
      <groupId>com.jayway.maven.plugins.android.generation2</groupId>
      <artifactId>android-maven-plugin</artifactId>
      <version>3.6.0</version>
      <configuration>
        <sdk>
          <platform>${android.sdk.platform}</platform>
        </sdk>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>
<extensions>
  <extension>
    <groupId>org.apache.maven.wagon</groupId>
    <artifactId>wagon-webdav-jackrabbit</artifactId>
    <version>2.4</version>
  </extension>
</extensions>

我是 Maven 新手,所以不知道这个错误消息是怎么回事。请帮忙看一下。谢谢。

最佳答案

我仍然不知道为什么会发生这种情况,但似乎打开 Android SDK Manager 并重新安装包含错误的包可能会有所帮助(在我的例子中安装 Android 1.5(API 3) 包括 SDK 平台和 Google API),然后再次运行 mvn 安装程序。

关于Android-Maven 安装时无法执行目标 org.codehaus.mojoto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19341685/

相关文章:

android - QR 码在 Android 中不起作用

java - 使用 Maven Resolver Provider 以编程方式获取有效的 POM

java - JUnit + Maven : accessing ${project. build.directory} 值

java - Maven : "Caused by: java.lang.NoClassDefFoundError: com/omnesys/omne/om/OMN"

testing - 如何使用 Maven 测试命令行应用程序?

android - 未找到 UID 10208 [安全异常] 的持久权限授予

javascript - 使用WebView在现场调用JS

java - j2objc直接引用无法解析(用Maven结构/src/main/java)

maven-2 - 如何告诉Maven2在新的JVM实例中一个一个地执行jUnit测试?

android - AppCompatActivity 中的 fragment