错误:无法执行目标

时间:2013-11-14 07:55:35

标签: maven path android-studio pom.xml

我已经从here下载了Robolectric示例代码,我正在通过Android工作室进行测试。我按照提到的in this link步骤进行了操作。 必须在pom.xml文件中提及该路径。我不确定它究竟是什么。这是我的pom.xml:

http://maven.apache.org/maven-v4_0_0.xsd">     4.0.0

<parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>5</version>
</parent>

<groupId>com.pivotallabs</groupId>
<artifactId>robolectricsample</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>RobolectricSample app</name>
<description>Sample project demonstrating use of the Robolectric Android testing project.</description>
<url>https://github.com/pivotal/RobolectricSample</url>

<properties>
    <robolectric.version>2.0</robolectric.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.roboguice</groupId>
        <artifactId>roboguice</artifactId>
        <version>2.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.0.1</version>
    </dependency>

    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>3.0</version>
        <classifier>no_aop</classifier>
    </dependency>

    <dependency>
        <groupId>org.robolectric</groupId>
        <artifactId>robolectric</artifactId>
        <version>${robolectric.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-core</artifactId>
        <version>1.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>

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

    <plugins>
        <plugin>
            <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.6.0</version>
            <configuration>
                <sdk>
                    <!-- platform or api level (api level 4 = platform 1.6)-->
                    <platform>17</platform>


                </sdk>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <excludes>
                    <exclude>**/Test*.java</exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

<scm>
    <url>git@github.com:pivotal/RobolectricSample.git</url>
    <connection>scm:git:git://github.com/pivotal/RobolectricSample.git</connection>
    <developerConnection>scm:git:git@github.com:pivotal/RobolectricSample.git</developerConnection>
</scm>

<developers>
    <developer>
        <id>tyler</id>
        <name>Tyler Schultz</name>
        <email>tyler@pivotallabs.com</email>
        <organization>Pivotal Labs</organization>
        <organizationUrl>http://pivotallabs.com/</organizationUrl>
        <roles>
            <role>Project Owner</role>
            <role>Developer</role>
        </roles>
        <timezone>PST/PDT</timezone>
    </developer>
    <developer>
        <id>phil</id>
        <name>Phil Goodwin</name>
        <email>phil@pivotallabs.com</email>
        <organization>Pivotal Labs</organization>
        <organizationUrl>http://pivotallabs.com/</organizationUrl>
        <roles>
            <role>Developer</role>
        </roles>
        <timezone>PST/PDT</timezone>
    </developer>
    <developer>
        <id>joemoore</id>
        <name>Joe Moore</name>
        <email>joe@pivotallabs.com</email>
        <organization>Pivotal Labs</organization>
        <organizationUrl>http://pivotallabs.com/</organizationUrl>
        <roles>
            <role>Developer</role>
        </roles>
        <timezone>EST/EDT</timezone>
    </developer>
</developers>
<licenses>
    <license>
        <name>MIT license</name>
        <comments>
            The MIT License

            Copyright (c) 2011 Pivotal Labs

            Permission is hereby granted, free of charge, to any person obtaining a copy
            of this software and associated documentation files (the "Software"), to deal
            in the Software without restriction, including without limitation the rights
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
            copies of the Software, and to permit persons to whom the Software is
            furnished to do so, subject to the following conditions:

            The above copyright notice and this permission notice shall be included in
            all copies or substantial portions of the Software.

            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
            THE SOFTWARE.
        </comments>
    </license>
</licenses>

我得到的错误如下:

“C:\ Program Files \ Java \ jdk1.7.0_45 \ bin \ java”“-Dmaven.home = C:\ Program Files(x86)\ Android \ apache-maven-3.0.5”“ - Dlassworlds。 conf = C:\ Program Files(x86)\ Android \ apache-maven-3.0.5 \ bin \ m2.conf“-Didea.launcher.port = 7534 -Didea.launcher.bin.path = C:\ Users \ ashish \ AppData \ Local \ Android \ android-studio \ bin -Dfile.encoding = UTF-8 -classpath“C:\ Program Files(x86)\ Android \ apache-maven-3.0.5 \ boot \ plexus-classworlds-2.4。 jar; C:\ Users \ ashish \ AppData \ Local \ Android \ android-studio \ lib \ idea_rt.jar“com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher test

无法在项目robolectricsample上执行目标com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources(default-generate-sources):找不到Android SDK路径。您可以在pom文件的插件配置部分使用...或...或在命令行上使用-Dandroid.sdk.path = ...或通过设置环境变量ANDROID_HOME - &gt;进行配置。 [帮助1] [错误] [错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。 [ERROR]使用-X开关重新运行Maven以启用完整的调试日志记录。 [错误] [错误]有关错误和可能解决方案的更多信息,请阅读以下文章: [错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

使用退出代码1完成处理

请提前帮助我,Thanx

0 个答案:

没有答案