我跟着instructions for configuring Maven建立了android项目,这就是我的POM看起来像
<project xmlns="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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>MavenMess</artifactId>
<version>1</version>
<packaging>apk</packaging>
<name>Maven Android Plugin - samples</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<version>2.6.0</version>
<configuration>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6)-->
<platform>8</platform>
</sdk>
<emulator>
<!-- the name of the avd device to use for starting the emulator-->
<avd>GoogleAPIs</avd>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- version 2.3 defaults to java 1.5, so no further configuration needed-->
<version>2.3</version>
</plugin>
</plugins>
</build>
</project>
我可以运行mvn install
,但是当我运行mvn deploy
时,我收到以下错误
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-deploy-plugin:2.4
check that the following section of the pom.xml is present and correct:
<distributionManagement>
<!-- use the following if you're not using a snapshot version. -->
<repository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</repository>
<!-- use the following if you ARE using a snapshot version. -->
<snapshotRepository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</snapshotRepository>
</distributionManagement>
Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Sun Nov 14 18:56:41 GMT 2010
[INFO] Final Memory: 58M/543M
[INFO] ------------------------------------------------------------------------
如果我不使用存储库该怎么办?
答案 0 :(得分:3)
如果您deploy
,则必须提供部署到(存储库)的位置。 deploy
的重点是将您的构建上传到某个服务器。
如果您只想创建应用程序包,请使用package
。
更新:使用android:deploy
部署到模拟器或设备。
答案 1 :(得分:1)
如果我没记错的话,如果你只是设置一个虚拟存储库(例如有效的url
格式,但服务器无效等),Maven会抱怨,但是要做它的工作。