我从ant切换到maven来构建android项目。但我发现使用android-maven插件配置我之前的ant项目非常困难。在配置此项目与官方示例项目相同之后,除了主项目下的源折叠尚未编译之外,一切正常。我已经多次检查了pom.xml,但是示例项目下的同一个pom.xml工作正常但不在我自己的项目中。
我发现src没有通过检查目标文件夹中的classes文件夹来编译。
这是我的pom.xml:
http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.jayway.maven.plugins.android.generation2.samples.libraryprojects libraryprojects父 1.0.0-SNAPSHOT com.jayway.maven.plugins.android.generation2.samples.libraryprojects libraryprojects-mainapp APK 图书馆项目 - 主要应用程序
<dependencies> <dependency> <groupId>com.google.android</groupId> <artifactId>android</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>lib5</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/libs/imageloader-core.jar</systemPath> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>lib2</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/libs/baidumapapi.jar</systemPath> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>lib6</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/libs/locSDK_3.3.jar </systemPath> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>lib8</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/libs/umeng_sdk.jar </systemPath> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>androidv4</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/libs/android-support-v4.jar </systemPath> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>lib9</artifactId> <version>1.0.0-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/libs/weibo.sdk.android.sso.jar </systemPath> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>pulltorefresh</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>libraryprojects-lib1</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>libraryprojects-lib2</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <!--<dependency>--> <!--<groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId>--> <!--<artifactId>libraryprojects-lib3</artifactId>--> <!--<version>1.0.0-SNAPSHOT</version>--> <!--<type>apklib</type>--> <!--</dependency>--> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>libraryprojects-lib4</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>libraryprojects-lib5</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <!--<dependency>--> <!--<groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId>--> <!--<artifactId>libraryprojects-lib7</artifactId>--> <!--<version>1.0.0-SNAPSHOT</version>--> <!--<type>apklib</type>--> <!--</dependency>--> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>libraryprojects-lib8</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>slidingmenu</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>libraryprojects-lib10</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> <dependency> <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId> <artifactId>actionbarsherlock</artifactId> <version>1.0.0-SNAPSHOT</version> <type>apklib</type> </dependency> </dependencies> <build> <finalName>${project.artifactId}</finalName> <sourceDirectory>${project.baseDir}</sourceDirectory> <plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <extensions>true</extensions> </plugin> </plugins> </build>
答案 0 :(得分:1)
似乎是源目录层次结构不适合maven。
对于普通的android项目,src层次结构为src/com/a/b
,但对于maven是`src / main / java / com / a / b'。