构建Android应用程序并使用Maven运行Robotium测试

构建Android应用程序并使用Maven运行Robotium测试,android,maven,jenkins,robotium,Android,Maven,Jenkins,Robotium,我真的需要你的帮助。我想设置Jenkins来构建我的Android应用程序,并使用Maven在emulator上运行我的Robotium测试。我想我做的一切都很好,但仍然有同样的错误。你有过这样的经历吗?我的项目结构如下: izi-mobiler.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="htt

我真的需要你的帮助。我想设置Jenkins来构建我的Android应用程序,并使用Maven在emulator上运行我的Robotium测试。我想我做的一切都很好,但仍然有同样的错误。你有过这样的经历吗?我的项目结构如下:

izi-mobiler.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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>pl.araneo.farmadroid</groupId>
    <artifactId>izi-mobiler</artifactId>
    <version>366</version>
    <packaging>pom</packaging>
    <name>IZI</name>

    <modules>
        <module>izi-mobiler-app</module>
        <module>izi-mobiler-test</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>

        <dependencies>

            <dependency>
                <groupId>com.google.android</groupId>
                <artifactId>android</artifactId>
                <version>4.0.1.2</version>
            </dependency>

            <dependency>
                <groupId>com.google.android</groupId>
                <artifactId>android-test</artifactId>
                <version>4.0.1.2</version>
            </dependency>

            <dependency>
                <groupId>com.pivotallabs</groupId>
                <artifactId>robolectric</artifactId>
                <version>1.2-SNAPSHOT</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>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-lgpl</artifactId>
                <version>1.7.1</version>
                <type>jar</type>
            </dependency>

            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>1.9.0</version>
            </dependency>

            <dependency>
                <groupId>org.roboguice</groupId>
                <artifactId>roboguice</artifactId>
                <version>2.0</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>com.google.inject.extensions</groupId>
                <artifactId>guice-multibindings</artifactId>
                <version>3.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.inject</groupId>
                        <artifactId>guice</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>com.google.inject.extensions</groupId>
                <artifactId>guice-assistedinject</artifactId>
                <version>3.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.inject</groupId>
                        <artifactId>guice</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>com.google.android</groupId>
                <artifactId>support-v4</artifactId>
                <version>r7</version>
            </dependency>

            <!-- Action Bar sherlock -->
            <dependency>
                <groupId>com.actionbarsherlock</groupId>
                <artifactId>library</artifactId>
                <version>4.1.0</version>
                <type>apklib</type>
            </dependency>

            <!-- Let Roboguice and Sherlock work together -->
            <dependency>
                <groupId>com.github.rtyley</groupId>
                <artifactId>roboguice-sherlock</artifactId>
                <version>1.4</version>
            </dependency>

        </dependencies>

    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.0.0-alpha-13</version>
                    <extensions>true</extensions>
                    <configuration>
                        <sdk>
                            <platform>15</platform>
                        </sdk>
                        <undeployBeforeDeploy>true</undeployBeforeDeploy>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

4.0.0
阿拉尼奥农场酒店
伊兹美孚
366
聚甲醛
伊兹
izi移动应用程序
伊齐移动试验
UTF-8
com.google.android
安卓
4.0.1.2
com.google.android
安卓测试
4.0.1.2
com.pivotallabs
生物分子
1.2-1
测试
org.hamcrest
汉克雷斯特岩芯
1.2
测试
朱尼特
朱尼特
4.8.2
测试
org.codehaus.jackson
jackson core lgpl
1.7.1
罐子
org.mockito
莫基托磁芯
1.9.0
org.roboguice
机器人向导
2
编译
com.google.inject.extensions
guice多重绑定
3
com.google.inject
圭斯
com.google.inject.extensions
guice助理项目
3
com.google.inject
圭斯
com.google.android
支持-v4
r7
com.actionbarsherlock
图书馆
4.1.0
apklib
com.github.rtyley
机器人向导夏洛克
1.4
com.jayway.maven.plugins.android.generation2
安卓maven插件
3.0.0-alpha-13
真的
15
真的
org.apache.maven.plugins
maven编译器插件
2.3.2

izi-mobiler-app.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>

<parent>
    <groupId>pl.araneo.farmadroid</groupId>
    <artifactId>izi-mobiler</artifactId>
    <version>366</version>
    <relativePath>../</relativePath>
</parent>

<groupId>pl.araneo.farmadroid</groupId>
<artifactId>izi-mobiler-app</artifactId>
<version>366</version>
<packaging>apk</packaging>
<name>IZI - App</name>

<properties>
    <platform.version>4.0.1.2</platform.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.pivotallabs</groupId>
        <artifactId>robolectric</artifactId>
        <scope>test</scope>
    </dependency>

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

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

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-lgpl</artifactId>
        <version>1.7.1</version>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.roboguice</groupId>
        <artifactId>roboguice</artifactId>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-multibindings</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.google.inject</groupId>
                <artifactId>guice</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-assistedinject</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.google.inject</groupId>
                <artifactId>guice</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>support-v4</artifactId>
    </dependency>

    <!-- Action Bar sherlock -->
    <dependency>
        <groupId>com.actionbarsherlock</groupId>
        <artifactId>library</artifactId>
        <type>apklib</type>
    </dependency>

    <!-- Let Roboguice and Sherlock work together -->
    <dependency>
        <groupId>com.github.rtyley</groupId>
        <artifactId>roboguice-sherlock</artifactId>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>3.4.0</version>
            <configuration>
                <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                <resourceDirectory>${project.basedir}/res</resourceDirectory>
                <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                <sdk>
                    <platform>15</platform>
                </sdk>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
            <extensions>true</extensions>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

4.0.0
阿拉尼奥农场酒店
伊兹美孚
366
../
阿拉尼奥农场酒店
izi移动应用程序
366
apk
IZI-App
4.0.1.2
UTF-8
com.google.android
安卓
假如
com.pivotallabs
生物分子
测试
org.hamcrest
汉克雷斯特岩芯
测试
朱尼特
朱尼特
测试
org.codehaus.jackson
jackson core lgpl
1.7.1
罐子
org.mockito
莫基托磁芯
org.roboguice
机器人向导
编译
com.google.inject.extensions
guice多重绑定
com.google.inject
圭斯
com.google.inject.extensions
guice助理项目
com.google.inject
圭斯
com.google.android
支持-v4
com.actionbarsherlock
图书馆
apklib
com.github.rtyley
机器人向导夏洛克
com.jayway.maven.plugins.android.generation2
安卓maven插件
3.4.0
${project.basedir}/AndroidManifest.xml
${project.basedir}/assets
${project.basedir}/res
${project.basedir}/src/main/native
15
真的
真的
maven编译器插件
2.5.1
1.6
1.6

izi-mobiler-test.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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>pl.araneo.farmadroid</groupId>
    <artifactId>izi-mobiler</artifactId>
    <version>366</version>
</parent>

<groupId>pl.araneo.farmadroid</groupId>
<artifactId>izi-mobiler-test</artifactId>
<packaging>apk</packaging>
<name>IZI - Test</name>

<dependencies>

    <dependency>
        <groupId>com.jayway.android.robotium</groupId>
        <artifactId>robotium-solo</artifactId>
        <version>1.8.0</version>
    </dependency>

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android-test</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>support-v4</artifactId>
    </dependency>

    <dependency>
        <groupId>com.actionbarsherlock</groupId>
        <artifactId>library</artifactId>
        <type>apklib</type>
    </dependency>

    <dependency>
        <groupId>com.github.rtyley</groupId>
        <artifactId>roboguice-sherlock</artifactId>
    </dependency>

    <dependency>
        <groupId>pl.araneo.farmadroid</groupId>
        <artifactId>izi-mobiler-app</artifactId>
        <version>366</version>
        <type>apk</type>
    </dependency>

    <dependency>
        <groupId>pl.araneo.farmadroid</groupId>
        <artifactId>izi-mobiler-app</artifactId>
        <version>366</version>
        <scope>compile</scope>
        <type>jar</type>
    </dependency>

</dependencies>

<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>

4.0.0
阿拉尼奥农场酒店
伊兹美孚
366
阿拉尼奥农场酒店
伊齐移动试验
apk
伊兹试验
com.jayway.android.robotium
机器人独奏
1.8.0
com.google.android
安卓
假如
com.google.android
安卓测试
假如
com.google.android
支持-v4
com.actionbarsherlock
图书馆
apklib
com.github.rtyley
机器人向导夏洛克
阿拉尼奥农场酒店
izi移动应用程序
366
apk
阿拉尼奥农场酒店
izi移动应用程序
366
编译
罐子
src
com.jayway.maven.plugins.android.generation2
安卓maven插件
真的

堆栈跟踪
[ERROR]编译错误:
[信息]-------------------------------------------------------------
[错误]/home/piotrslesarew/git/izi mobiler/izi mobiler test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[7,7]错误:无法访问TestCase
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[7,7] error: cannot access TestCase
[ERROR]   class file for junit.framework.TestCase not found
/home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[17,24] error: cannot find symbol
[ERROR]  class DashboardViewTest
/home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[17,46] error: cannot find symbol
[ERROR]  class DashboardViewTest
/home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[15,4] error: method does not override or implement a method from a supertype
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] IZI ............................................... SUCCESS [0.183s]
[INFO] IZI - App ......................................... SUCCESS [36.895s]
[INFO] IZI - Test ........................................ FAILURE [3.741s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.924s
[INFO] Finished at: Sat Nov 17 16:40:51 CET 2012
[INFO] Final Memory: 35M/354M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project izi-mobiler-test: Compilation failure: Compilation failure:
[ERROR] /home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[7,7] error: cannot access TestCase
[ERROR] class file for junit.framework.TestCase not found
[ERROR] /home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[17,24] error: cannot find symbol
[ERROR] class DashboardViewTest
[ERROR] /home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[17,46] error: cannot find symbol
[ERROR] class DashboardViewTest
[ERROR] /home/piotrslesarew/git/izi-mobiler/izi-mobiler-test/src/main/java/pl/araneo/farmadroid/ui/activities/test/DashboardViewTest.java:[15,4] error: method does not override or implement a method from a supertype
[ERROR] -> [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/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :izi-mobiler-test
<dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.8.2</version>
     <scope>compile</scope>
</dependency>