我正在尝试使用 maven 构建一个 android 项目,但 maven 不喜欢 Qname 类:
[INFO] /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java [-Xms256m, -Xmx512m, -jar, /Users/bry_m/code/android-sdk-macosx/platform-tools/lib/dx.jar, --dex, --output=/Users/bry_m/code/eclipse_workspace_2mar2012/maven.1331582410730/trunk/target/classes.dex, /Users/bry_m/code/eclipse_workspace_2mar2012/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/springframework/android/spring-android-rest-template/1.0.0.M2/spring-android-rest-template-1.0.0.M2.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/codehaus/jackson/jackson-mapper-asl/1.6.4/jackson-mapper-asl-1.6.4.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/json/json/20080701/json-20080701.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/com/google/android/android/2.3.1/android-2.3.1.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/commons-codec/commons-codec/1.3/commons-codec-1.3.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/codehaus/jackson/jackson-jaxrs/1.6.4/jackson-jaxrs-1.6.4.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/maven.1331582410730/trunk/target/classes, /Users/bry_m/code/eclipse_workspace_2mar2012/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/codehaus/jackson/jackson-core-asl/1.6.4/jackson-core-asl-1.6.4.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/org/twitter4j/twitter4j-core/2.2.6-SNAPSHOT/twitter4j-core-2.2.6-SNAPSHOT.jar, /Users/bry_m/code/eclipse_workspace_2mar2012/cocos2d_android/cocos2d_android/1.0.0-SNAPSHOT/cocos2d_android-1.0.0-SNAPSHOT.apklib, /Users/bry_m/code/eclipse_workspace_2mar2012/com/codeslap/android-facebook/1.5/android-facebook-1.5.jar]
[INFO]
[INFO] trouble processing "javax/xml/namespace/QName.class":
[INFO]
[INFO] Ill-advised or mistaken usage of a core class (java.* or javax.*)
[INFO] when not building a core library.
当我引入一个单独的 apklib 文件时,这个问题才开始出现:
<dependency>
<groupId>cocos2d_android</groupId>
<artifactId>cocos2d_android</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>apklib</type>
</dependency>
看来QName
该类只出现在我的 xpp3 jarfile 的依赖项中,据我所知,它只出现在这个依赖项中:
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android-version}</version>
</dependency>
我尝试使用排除标记来让 Maven 很好地使用它,但是 xmlpullparser 类正在我的项目中的代码中使用,所以当我排除它时出现类未找到错误。
为了完整起见,这是我的完整依赖项列表:
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android-version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>${jacksonVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework.android</groupId>
<artifactId>spring-android-rest-template</artifactId>
<version>${spring-android-version}</version>
</dependency>
<dependency>
<groupId>com.codeslap</groupId>
<artifactId>android-facebook</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>cocos2d_android</groupId>
<artifactId>cocos2d_android</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[2.2,)</version>
</dependency>
</dependencies>
我已经看到其他问题谈论这个被导入到其他谷歌数据 api 中,但显然我没有在这里使用这些 - 有人可以解释为什么 Maven 抱怨这个只是主要谷歌 android api 的一部分的类吗?