您的位置:首页 > 其它

Maven 问题总结

2015-03-18 15:32 316 查看


高效建立健壮的Android应用-Maven Android 开发文中提到,Maven in Android 听起来很牛逼,你是不是很想马上弄个HelloWorld,但是你可能要懊恼了,因为你马上回碰到Project
build error: Unknown packaging: apk的错误,然后就停在这里了,我之前也是因为碰到这个问题就停了,然后就想骂人,特别是那个引诱你尝试的那个人(比如我),好了。这就是本文的来源。本文也会对不断碰到的问题进行总结,你有特别的问题也可用提出来,我到时候进行总结.


问题集合

Project build error: Unknown packaging: apk,

在Eclipse中安装m2e-android插件
安装源:http://rgladwell.github.com/m2e-android/updates/

安装方法:Help -> Install new Software -> 在出来的对话框中点击 Add ->

Name:m2e-android
Location:http://rgladwell.github.com/m2e-android/updates/

然后就下一步下一步了,你懂的.

也可以通过:
Preferences -> Maven -> Discovery and click "Open Catalog".然后选择 m2e     android connector 安装好以后就可以解决这个问题了


maven-resources-plugin prior to 2.4 is not supported by m2e. Use maven-resources-plugin version 2.4 or later.
在项目的pom.xml中修改你的org.apache.maven.plugins的版本号,可直接复制下面那一段更新

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>


dependency=[com.actionbarsherlock:library:apklib:4.1.0:compile] not found in 

workspace

com.actionbarsherlock.library 换了artifactId了,是actionbarsherlock,并且使用4.4.0的版本..

Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:consume- 

aar (execution: default-consume-aar, phase: compile)

可参考1参考2 

好了,在你的maven配置里,增加如下一段即可解决: 

org.eclipse.m2e 

lifecycle-mapping 

1.0.0 

com.jayway.maven.plugins.android.generation2 

android-maven-plugin 

3.5.0 

manifest-update 

No Android SDK path could be found.

在settings.xml里面添加(如果你连settings.xml都没的话请点这里
<profiles>
<profile>
<id>android</id>
<properties>
<android.sdk.path>
/Users/lily/android-sdk-macosx <!-- 此处为自己sdk路径 -->
</android.sdk.path>
</properties>
</profile>
</profiles>
<activeProfiles> <!--make the profile active all the time -->
<activeProfile>android</activeProfile>
</activeProfiles>


@Override 的代码全部都报错
默认Maven中的JAVA版本是1.5,只要修改成1.6就好了

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>


java.lang.ClassNotFoundException: org.sonatype.aether.RepositorySystem

请看BUG issue 395 on Maven Android plugin
使用最新版本的Maven3.1.1,使用3.8的android-maven-plugin
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
</plugin>


maven和android-maven-plugin版本不匹配,常常会出现的错误(答案就在问题里面哦)
http://stackoverflow.com/questions/19174392/failed-to-execute-goal-com-jayway-maven-plugins-android-generation2
Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources (default-generate-sources) on project my-android-application: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources
failed: A required class was missing while executing com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources: Lorg/sonatype/aether/RepositorySystem;

最后原文出处  http://my.oschina.net/huami/blog/175570
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  maven 问题总结