1.把maven的插件包拷贝到eclipse相关目录;
2.在maven安装目录中的setting.xml文件中修改成 <localRepository>D:/.m2/repository</localRepository>;
3.在eclipse中的maven选项中,选择自己定义的setting.xml文件。
搭配maven eclipse android环境:
1.You will need 'Eclipse Indigo or Juno ' installed.
You can install the Android Connector for Maven via the Eclipse Marketplace. SelectHelp -> Eclipse Marketplace... and search for "android m2e".
2. 到下面网站下载Maven的中心库,
http://search.maven.org/#search|ga|1|android-quickstart
之后复制到Maven的repository中
之后在Eclipse中,new Maven project , 添加原型archieve, 定位到上面的Maven中心库
之后自定义GroupId 和 ArtifactId
之后就能新建Android 项目了
此外如果新建Android项目之后可以Convert To Maven, 虽然新建的是Android 4.0 但是还是可以用Maven导入其他的依赖项,只需要添加dependency即可
最后附上一份pom的模板(如果新建Maven Android 还是需要自己调整pom的配置)
pom.xml
- <projectxmlns="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>myandroid</groupId>
- <artifactId>AndroidIMProject</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>apk</packaging>
- <properties>
- <platform.version> 2.2.1
- </platform.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>com.google.android</groupId>
- <artifactId>android</artifactId>
- <version>${platform.version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>com.jayway.maven.plugins.android.generation2</groupId>
- <artifactId>android-maven-plugin</artifactId>
- <version>3.5.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>8</platform>
- </sdk>
- <undeployBeforeDeploy>true</undeployBeforeDeploy>
- </configuration>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </project>
-------------------------------无聊的分割线-------------------------------------------------------
http://blog.csdn.net/anialy/article/details/8539182 参考这个人的配置