Android:包含/重新打包引用 javax 核心类的依赖项时出错
我正在开发一个使用 Maven 作为构建工具的 Android 应用程序。我成功地正确设置了所有内容(maven 依赖项导出到 apk 等),但是我还有一个剩余的问题让我发疯。
我想在我的 POM 文件中包含对 simpleframework 的 xml 解析器 的依赖项,定义如下:
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.5.3</version>
</dependency>
当我发出 时mvn install
在项目上,我收到以下错误(已截断):
trouble processing "javax/xml/namespace/NameSpaceContext.class" ...
我知道引用这些 javax-classes 的简单 xml 解析器的错误结果,但是我还没有找到解决方案(设置 --core -library 标志没有用)。
我目前正在尝试使用 maven-jarjar-pluging 重新打包依赖项,但这似乎也不起作用。
谁能帮我解决这个问题吗?非常非常感谢!
I'm working on an Android app using Maven as the build tool. I managed to set evertyhing up correctly (maven dependencies are exported to the apk etc.), however I have one remaining problem which is driving me crazy.
I want to include a dependency on simpleframework's xml parser defined as follows in my POM file:
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.5.3</version>
</dependency>
When I issue mvn install
on the project, I get the following error (truncated):
trouble processing "javax/xml/namespace/NameSpaceContext.class" ...
I know the error results from the simple xml parser referencing these javax-classes, however I haven't found a solution yet (setting the --core-library flag is of no use).
I'm currently trying to repack the dependency with the maven-jarjar-pluging but this doesn't seem to work either.
Can anyone help me out with this? Many, many thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
像这样定义您的 simple-xml 依赖关系:
Define your simple-xml depedency like this :
我使用 android-maven-plugin,并将
true
添加到 POM 中插件的
标记对我有用。但是,有一个错误: https://github.com/jayway/maven-android -plugin/pull/34,您需要包含它来修复您正在使用的插件,因为该错误直到 3.0 才会得到修复。以下是我如何使用 2.9.0-SNAPSHOT 让它为我工作。修复进入 2.9.0-SNAPSHOT 后,步骤 3-6 就不再需要了。
2010 年 7 月更新:2.9.0-beta-4 已修复,因此如果您使用 2.9.0-beta-4 或更高版本,则不需要上述解决方法。我测试了 2.9.0-beta-5,效果很好。
I use android-maven-plugin, and adding
<coreLibrary>true</coreLibrary>
to the<configuration>
tag of the plugin in the POM works for me. However, there's a bug: https://github.com/jayway/maven-android-plugin/pull/34, that you need to include to fix the plugin you are using, since the bug won't be fixed until 3.0. Here's how I got it working for me using 2.9.0-SNAPSHOT.Step 3-6 won't be necessary after the fix gets into 2.9.0-SNAPSHOT.
Update July 2010: 2.9.0-beta-4 has the fix, so you don't need the above workaround if you use 2.9.0-beta-4 or later. I tested 2.9.0-beta-5 which worked just fine.
Spring Android 使用 Maven 来集成 Simple。看一下下面的 URL,它应该提供有关如何让 Maven 与 Simple 一起工作的指导。
http://static.springsource.org /spring-android/docs/1.0.x/reference/html/rest-template.html
Spring Android uses Maven to integrate Simple. Take a look at the following URL, it should provide pointers on how to get Maven working with Simple.
http://static.springsource.org/spring-android/docs/1.0.x/reference/html/rest-template.html