我在构建 android maven 项目(eclipse m2e,android for maven)时遇到问题。
“安装”目标恢复为:
[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
[INFO] java.lang.IllegalArgumentException: already added: Ljavax/persistence/Access;
[INFO] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
我在项目中添加了以下依赖项:
<dependency>
<groupId>org.odata4j</groupId>
<artifactId>odata4j-jersey</artifactId>
<version>0.7.0</version>
</dependency>
此依赖项还(除其他外)添加了 javax.persistence-2.0.0.jar。
所以我认为图书馆被添加了两次?但是如何解决这个问题呢?当我删除依赖项时,可以毫无错误地构建项目。
这是命令的输出:maven dependency:tree
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ myapp ---
[INFO] org.subby.android:myapp:apk:0.0.1-SNAPSHOT
[INFO] +- com.google.android:android:jar:4.1.1.4:provided
[INFO] | +- commons-logging:commons-logging:jar:1.1.1:provided
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.0.1:provided
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.0.1:provided
[INFO] | | +- (commons-logging:commons-logging:jar:1.1.1:provided - omitted for duplicate)
[INFO] | | \- commons-codec:commons-codec:jar:1.3:provided
[INFO] | +- org.khronos:opengl-api:jar:gl1.1-android-2.1_r1:provided
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:provided
[INFO] | +- xpp3:xpp3:jar:1.1.4c:provided
[INFO] | \- org.json:json:jar:20080701:provided
[INFO] \- org.odata4j:odata4j-jersey:jar:0.7.0:compile
[INFO] +- org.odata4j:odata4j-core:jar:0.7.0:compile
[INFO] | +- org.core4j:core4j:jar:0.5:compile
[INFO] | +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] | +- org.eclipse.persistence:javax.persistence:jar:2.0.0:compile
[INFO] | +- org.eclipse.persistence:eclipselink:jar:2.1.2:compile
[INFO] | \- joda-time:joda-time:jar:1.6:compile
[INFO] +- com.sun.jersey:jersey-core:jar:1.1.5:compile
[INFO] | \- (javax.ws.rs:jsr311-api:jar:1.1.1:compile - omitted for duplicate)
[INFO] +- com.sun.jersey:jersey-server:jar:1.1.5:compile
[INFO] | +- (com.sun.jersey:jersey-core:jar:1.1.5:compile - omitted for duplicate)
[INFO] | \- asm:asm:jar:3.1:compile
[INFO] \- com.sun.jersey:jersey-client:jar:1.1.5:compile
[INFO] \- (com.sun.jersey:jersey-core:jar:1.1.5:compile - omitted for duplicate)
难道我做错了什么?我对 Maven 还是很陌生。
谢谢!