我從ant切換到maven來構建android項目。但是我發現用android-maven插件配置我之前的ant項目非常困難。在配置這個項目與官方示例項目相同之後,除了主項目下的源代碼摺疊沒有被編譯之外,所有東西都可以找到。我已經多次檢查了pom.xml,但示例項目下的pom.xml運行正常,但不在我自己的項目中。maven不會編譯源文件夾
我發現沒有通過檢查目標文件夾中的classes文件夾來編譯src。
這裏是我的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>
看看:http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html你是否按照這些步驟? – adchilds