简体   繁体   English

Android Maven从罐子里错过了我的课

[英]Android maven misses my classes from the jar

I'm compiling my Android app using 我正在使用编译我的Android应用程序

mvn clean install mvn全新安装

When I look into the generated jar my application classes are missing, so my junit tests in another test project will not compile. 当我查看生成的jar时,我的应用程序类丢失了,因此在另一个测试项目中的junit测试将无法编译。

Any idea what I need to do to add all my *.class files into the .m2\\repository\\com\\twenty71\\jenkinsApp3\\1.0.0-SNAPSHOTjar\\jenkinsApp3-1.0.0-SNAPSHOT.jar? 知道将我的所有* .class文件添加到.m2 \\ repository \\ com \\ twenty71 \\ jenkinsApp3 \\ 1.0.0-SNAPSHOTjar \\ jenkinsApp3-1.0.0-SNAPSHOT.jar时需要做什么吗?

The mvn built app runs fine, so it's just the jar that's a problem. mvn内置的应用程序运行良好,因此,仅仅是jar存在问题。

This is my pom.xml file: 这是我的pom.xml文件:

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

<groupId>com.twenty71</groupId>
<artifactId>jenkinsApp3</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>jenkinsApp3</name>

<dependencies>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v7-appcompat</artifactId>
        <version>19.1.0</version>
        <type>apklib</type>
    </dependency>
    <dependency>
        <groupId>android.support</groupId>
        <artifactId>compatibility-v7-appcompat</artifactId>
        <version>19.1.0</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>support-v4</artifactId>
        <version>r7</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>3.9.0-rc.1</version>
            <configuration>
                <sdk>
                    <platform>19</platform>
                </sdk>
                <deleteConflictingFiles>true</deleteConflictingFiles>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>

            </configuration>
        </plugin>
    </plugins>
</build>

Please check out you folder structure, some time before I also encounter this problem. 在我也遇到此问题之前,请检查一下您的文件夹结构。 Maven assumes a /src/main/java/ structure. Maven假定为/ src / main / java /结构。
First try to create a maven project by command: 首先尝试通过命令创建一个Maven项目:

$ mvn archetype:generate -DgroupId=com.abc.xy. -DartifactId=projectName -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=true.

"-DinteractiveMode=true" “-DinteractiveMode =真”

by this you may choose your folder structure which maven supports for Android (I never worked with android before so don't have knowledge about its structure) 通过这种方式,您可以选择maven支持Android的文件夹结构(我之前从未使用过android,所以不了解其结构)
Then, here Maven will take the folder structure for you, just put your .java file in its /src/main/java/ folder, then build your project again. 然后,这里Maven将为您准备文件夹结构,只需将.java文件放在其/ src / main / java /文件夹中,然后再次构建您的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM