Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Maven编译Android测试_Android_Unit Testing_Maven_Continuous Integration - Fatal编程技术网

使用Maven编译Android测试

使用Maven编译Android测试,android,unit-testing,maven,continuous-integration,Android,Unit Testing,Maven,Continuous Integration,这几天来我一直在用我的头来抨击这件事,所以我想是时候问一下了 我有一个android项目和一个android测试项目。我可以在eclipse中运行我的测试,一切都很好 所以现在我通过maven继续使用这些测试,这样我就可以将它们用于CI 总之,长话短说,我无法让maven编译/运行它们。我已经看过了android maven插件提供的所有示例,但都没有用 主POM <groupId>com.xxx.x_android_finder</groupId> <artifa

这几天来我一直在用我的头来抨击这件事,所以我想是时候问一下了

我有一个android项目和一个android测试项目。我可以在eclipse中运行我的测试,一切都很好

所以现在我通过maven继续使用这些测试,这样我就可以将它们用于CI

总之,长话短说,我无法让maven编译/运行它们。我已经看过了android maven插件提供的所有示例,但都没有用

主POM

<groupId>com.xxx.x_android_finder</groupId>
<artifactId>x_Android_Finder</artifactId>
<version>1.0.2</version>
<packaging>apk</packaging>
<name>xxxx</name>

<dependencies>
   <!--    <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.8.1</version>
          <scope>test</scope>
    </dependency> -->
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.0.1.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
<groupId>com.google.android.maps</groupId>
        <artifactId>maps</artifactId>
        <version>15_r2</version>
        <scope>provided</scope>
    </dependency>

   <dependency>
        <groupId>com.actionbarsherlock</groupId>
        <artifactId>library</artifactId>
        <version>4.1.0</version>
        <type>apklib</type>
        <exclusions>
            <exclusion>
                <groupId>com.google.android</groupId>
                <artifactId>support-v4</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.actionbarsherlock</groupId>
        <artifactId>plugin-maps</artifactId>
        <version>4.1.0</version>
    </dependency> 

    <dependency>
        <groupId>net.hockeyapp.android</groupId>
        <artifactId>HockeySDK</artifactId>
        <version>2.0.2</version>
        <type>apklib</type>
    </dependency>

    <dependency>
        <groupId>com.codeslap</groupId>
        <artifactId>android-facebook</artifactId>
        <version>1.6</version>
        <scope>compile</scope>
    </dependency>

     <dependency>
       <groupId>org.twitter4j</groupId>
       <artifactId>twitter4j-core</artifactId>
       <version>[3.0,)</version>
   </dependency>

</dependencies>

<repositories>
    <repository>
        <id>jakewharton</id>
        <url>http://r.jakewharton.com/maven/release/</url>
    </repository>
    <repository>
        <id>codeslap</id>
        <url>http://casidiablo.github.com/codeslap-maven/repository/</url>
    </repository>

</repositories>

<build>

    <plugins>



        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>3.2.0</version>
            <extensions>true</extensions>

            <configuration>
                <!-- replace resources with target specific -->


                <renameManifestPackage>${customerPackage}</renameManifestPackage> 
                <resourceOverlayDirectory>${customerResources}</resourceOverlayDirectory>

                 <sign>
                    <debug>false</debug>
                 </sign>
                  <manifest>
                    <versionCodeAutoIncrement>true</versionCodeAutoIncrement>
                  </manifest>
                   <zipalign>
                    <inputApk>${project.build.directory}/${project.build.finalName}.apk</inputApk>
                    <outputApk>${project.build.directory}/x_Android_Finder.apk</outputApk>
                 </zipalign>

               <proguard>
                    <skip>true</skip>
                </proguard>

                <sdk>
                    <!-- platform or api level (api level 4 = platform 1.6)-->
                    <platform>17</platform>
                </sdk>
                <assetsDirectory>${project.basedir}/${customerAssets}</assetsDirectory>
                <resourceDirectory>${project.basedir}/res</resourceDirectory>
            </configuration>

            <executions>
                <execution>
                    <id>manifestUpdate</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>manifest-update</goal>
                    </goals>
                </execution>
                <execution>
                    <id>alignApk</id>
                    <phase>package</phase>
                    <goals>
                        <goal>zipalign</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <version>1.2</version>
            <executions>
                <execution>
                    <id>signing</id>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                    <phase>package</phase>

                    <inherited>true</inherited>
                    <configuration>
                        <archiveDirectory></archiveDirectory>
                        <includes>
                            <include>target/*.apk</include>
                        </includes>
                        <keystore>../certificates/xxx.keystore</keystore>
                        <storepass>xxxx</storepass>
                        <keypass>xxxx</keypass>
                        <alias>csl</alias>

                    </configuration>
                </execution>
            </executions>
        </plugin>

        <!-- <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
       </plugin> -->

    </plugins>
</build>
com.xxx.x\u android\u finder
x_Android_Finder
1.0.2
apk
xxxx
com.google.android
安卓
4.0.1.2
假如
com.google.android.maps
地图
15_r2
假如
com.actionbarsherlock
图书馆
4.1.0
apklib
com.google.android
支持-v4
com.actionbarsherlock
插件映射
4.1.0
net.hockeyapp.android
曲棍球俱乐部
2.0.2
apklib
com.codeslap
安卓facebook
1.6
编译
org.twitter4j
twitter4j核
[3.0,)
杰克沃顿
http://r.jakewharton.com/maven/release/
代码板
http://casidiablo.github.com/codeslap-maven/repository/
com.jayway.maven.plugins.android.generation2
安卓maven插件
3.2.0
真的
${customerPackage}
${customerResources}
假的
真的
${project.build.directory}/${project.build.finalName}.apk
${project.build.directory}/x_Android_Finder.apk
真的
17
${project.basedir}/${customerAssets}
${project.basedir}/res
声明更新
过程资源
清单更新
alignApk
包裹
优化
org.apache.maven.plugins
maven jarsigner插件
1.2
签字
签名
包裹
真的
target/*.apk
../certificates/xxx.keystore
xxxx
xxxx
csl

测试聚甲醛

    <artifactId>x_Android_Finder_Test</artifactId>
    <packaging>apk</packaging>
    <version>1.0.0</version>
    <name>xxxxx</name>


    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android-test</artifactId>
            <version>1.5_r3</version>
          </dependency>

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

        <dependency>
            <groupId>com.google.android.maps</groupId>
            <artifactId>maps</artifactId>
            <version>15_r2</version>
            <scope>provided</scope>
        </dependency>

       <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>library</artifactId>
            <version>4.1.0</version>
            <type>apklib</type>
            <exclusions>
                <exclusion>
                    <groupId>com.google.android</groupId>
                    <artifactId>support-v4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>plugin-maps</artifactId>
            <version>4.1.0</version>
        </dependency> 

        <dependency>
            <groupId>com.connectionservices.csl_android_finder</groupId>
            <artifactId>Csl_Android_Finder</artifactId>
            <type>apk</type>
            <version>1.0.2</version>
        </dependency>

        <dependency>
            <groupId>com.connectionservices.csl_android_finder</groupId>
            <artifactId>Csl_Android_Finder</artifactId>
            <scope>provided</scope>
            <type>jar</type>
            <version>1.0.2</version>
        </dependency>


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

        <dependency>
            <groupId>net.hockeyapp.android</groupId>
            <artifactId>HockeySDK</artifactId>
            <version>2.0.2</version>
            <type>apklib</type>
        </dependency>

        <dependency>
            <groupId>com.codeslap</groupId>
            <artifactId>android-facebook</artifactId>
            <version>1.6</version>
            <scope>compile</scope>
        </dependency>

         <dependency>
           <groupId>org.twitter4j</groupId>
           <artifactId>twitter4j-core</artifactId>
           <version>[3.0,)</version>
       </dependency>

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

    </dependencies>

    <repositories>
        <repository>
            <id>oss.sonatype.org-jayway-with-staging</id>
            <url>http://oss.sonatype.org/content/groups/jayway-with-staging/</url>
        </repository>

        <repository>
             <id>jakewharton</id>
            <url>http://r.jakewharton.com/maven/release/</url>
         </repository>


         <repository>
             <id>codeslap</id>
             <url>http://casidiablo.github.com/codeslap-maven/repository/</url>
         </repository>

    </repositories>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>


            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>

                <configuration>
                    <sdk>
                        <platform>15</platform>
                    </sdk>

            <test>

                        <createReport>true</createReport>

                    </test>

                </configuration>
                <extensions>true</extensions>


            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.13</version>

              </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jarsigner-plugin</artifactId>
                <!--   <version>1.2</version> -->
                <executions>
                    <execution>
                        <id>signing</id>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <phase>package</phase>

                        <inherited>true</inherited>
                        <configuration>
                            <removeExistingSignatures>true</removeExistingSignatures>

                            <archiveDirectory></archiveDirectory>
                            <includes>
                                <include>target/*.apk</include>
                            </includes>
                            <keystore>../certificates/xxxx.keystore</keystore>
                            <storepass>xxx</storepass>
                            <keypass>xxxx</keypass>
                            <alias>csl</alias>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins> 
    </build>
</project>
x_Android_Finder_测试
apk
1.0.0
xxxxx
com.google.android
安卓测试
1.5_r3
com.google.android
安卓
4.0.1.2
假如
com.google.android.maps
地图
15_r2
假如
com.actionbarsherlock
图书馆
4.1.0
apklib
com.google.android
支持-v4
com.actionbarsherlock
插件映射
4.1.0
com.connectionservices.csl\u android\u finder
Csl_Android_Finder
apk
1.0.2
com.connectionservices.csl\u android\u finder
Csl_Android_Finder
假如
罐子
1.0.2
朱尼特
朱尼特
4.8.1
测试
net.hockeyapp.android
曲棍球俱乐部
2.0.2
apklib
com.codeslap
安卓facebook
1.6
编译
org.twitter4j
twitter4j核
[3.0,)
com.jayway.android.robotium
机器人独奏
3.6
oss.sonatype.org-jayway-with-staging
http://oss.sonatype.org/content/groups/jayway-with-staging/
杰克沃顿
http://r.jakewharton.com/maven/release/
代码板
http://casidiablo.github.com/codeslap-maven/repository/
${project.artifactId}
com.jayway.maven.plugins.android.generation2
安卓maven插件
15
真的
真的
org.apache.maven.plugins
maven surefire插件
2.13
org.apache.maven.plugins
maven jarsigner插件
签字
签名
包裹
真的
真的
ERROR] /Users/aidenfry/AndroidHSF(trunknew)/x_Android_Finder_Parent/x_Android_Finder_Test/src/main/java/com/xxxxxxx/x_android_finder_test/FinderActivityTest.java:[27,7] cannot access junit.framework.TestCase
[ERROR] class file for junit.framework.TestCase not found
[ERROR] public class FinderActivityTest extends ActivityInstrumentationTestCase2<FinderActivity> {
[ERROR] /Users/aidenfry/AndroidHSF(trunknew)/x_Android_Finder_Parent/x_Android_Finder_Test/src/main/java/com/xxxx/xx_android_finder_test/FinderActivityTest.java:[39,8] cannot find symbol
[ERROR] symbol  : variable super
[ERROR] location: class 
<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <!-- scope is compile, not test! -->
      <scope>compile</scope>
</dependency>