【问题标题】:Maven Failed to execute goal com.jayway.maven.plugins.android.generation2Maven 无法执行目标 com.jayway.maven.plugins.android.generation2
【发布时间】:2014-01-27 17:58:03
【问题描述】:

我想要一个简单的带有 maven 的 android hello world 程序。这是我的 pom.xml 文件

<?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>
    <groupId>appzoyfoo141</groupId>
    <artifactId>ekanta</artifactId>
    <version>1.0.0</version>
    <packaging>apk</packaging>
    <name>ekanta</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <platform.version>4.1.1.4</platform.version>
        <android.plugin.version>3.1.1</android.plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>${android.plugin.version}</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <platform>17</platform>
                        <path>${ANDROID_HOME}</path>
                    </sdk>
                </configuration>
            </plugin>   
        </plugins>
    </build>
</project>

但是在尝试运行 pom.xml 时右键单击 pom.xml->runas->maven test..getting this error

Failed to execute goal com.jayway.maven.plugins.android.generation2`..Can anybody plz help me..thanks  i am getting this error in console`[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.613s
[INFO] Finished at: Thu Jan 09 14:47:46 IST 2014
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources (default-generate-sources) on project ekanta: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME -> [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`

【问题讨论】:

  • 我的猜测是 maven 没有替换你的 pom 中的 ${ANDROID_HOME} 属性,因此这不是一个有效的路径,因此是例外。尝试将ANDROID_HOME 设置为环境变量(因此在maven 之外),然后完全删除pom 中插件的&lt;path&gt; 配置或更改pom 中的&lt;path&gt; 配置以指向android sdk 的位置明确的。

标签: java android xml eclipse maven


【解决方案1】:

我在尝试构建 Android Bootstrap 项目时遇到了与 com.jayway.maven 插件相同的问题。
我可以通过进入 pom.xml 属性部分并添加我的 ANDROID sdk 路径来解决此问题。

<properties>
    <abs.version>4.3.1</abs.version>
    <dagger.version>1.0.1</dagger.version>
    <otto.version>1.3.4</otto.version>
    <gson.version>2.2.4</gson.version>
    <menudrawer.version>3.0.2</menudrawer.version>
    <android.sdk.path>C:\Android\adt-bundle-windows-x86_64-20131030\sdk</android.sdk.path>
</properties>

我最初让它指向导致它失败的我的 JAVA SDK -- 你需要将它指向你的 ANDROID sdk。

【讨论】:

    【解决方案2】:

    此路径未设置:ANDROID_HOME,您的 SDK 版本可能太低。然后在setting.xml之后设置完整路径android sdk。

    【讨论】:

    • 什么是setting.xml?请详细说明。
    猜你喜欢
    • 1970-01-01
    • 2013-10-11
    • 1970-01-01
    • 2014-07-20
    • 2016-03-15
    • 2023-03-17
    • 2019-07-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多