Maven、ActionBarSherlock v4 和 Roboguice v2 - 如何构建它?

发布于 2024-12-28 10:33:04 字数 1175 浏览 1 评论 0原文

我正在尝试构建一个项目来同时使用 ActionBarSherlock v4 和 Roboguice v2 (我喜欢走在最前沿:))。

问题是ABS使用了稍微修改的兼容性 Roboguice 需要的库。我让它在 Eclipse 下工作得很好 添加actionbarsherlock-plugin-compat-lib-4.0.0-SNAPSHOTroboguice-2.0b3ActionBarSherlock 项目。

现在的问题是,在Maven下,我需要包含以下内容 由于 Roboguice 的依赖关系:

<dependency>
   <groupId>android</groupId>
   <artifactId>compatibility-v4</artifactId>
   <version>r3-SNAPSHOT</version>
</dependency>

我需要为 ABS 添加以下依赖关系:

<dependency>
   <groupId>com.actionbarsherlock</groupId>
   <artifactId>plugin-compat-lib</artifactId>
   <version>4.0.0-SNAPSHOT</version>
</dependency>

当我执行“mvn clean install”时,会发生以下错误:

[INFO] java.lang.IllegalArgumentException: already added: Landroid/
support/v4/app/ActivityCompatHoneycomb;

因为 ActivityCompatHoneycomb 存在于两个依赖关系中。

有什么建议吗?

完整的源代码和构建项目可在以下位置获取: https://github.com/thierryd/adg-android

I'm trying to build a project to uses both ActionBarSherlock v4 and Roboguice v2
(I like beeing of the bleeding edge :) ).

The problem is that ABS uses a slightly modified compatibility
library, that Roboguice needs. I got it working fine under Eclipse by
adding actionbarsherlock-plugin-compat-lib-4.0.0-SNAPSHOT,
roboguice-2.0b3 and the ActionBarSherlock project.

Now the problem is that under Maven, I need to include the following
dependency because of Roboguice:

<dependency>
   <groupId>android</groupId>
   <artifactId>compatibility-v4</artifactId>
   <version>r3-SNAPSHOT</version>
</dependency>

And I need to add the following dependency for ABS:

<dependency>
   <groupId>com.actionbarsherlock</groupId>
   <artifactId>plugin-compat-lib</artifactId>
   <version>4.0.0-SNAPSHOT</version>
</dependency>

When I do a "mvn clean install", the following error occurs:

[INFO] java.lang.IllegalArgumentException: already added: Landroid/
support/v4/app/ActivityCompatHoneycomb;

because ActivityCompatHoneycomb is present in both dependency.

Any suggestions?

The full source code and build project is available at:
https://github.com/thierryd/adg-android

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

み零 2025-01-04 10:33:04

感谢@dma_k,它通过添加以下“排除”标签并删除“compatibility-v4”依赖项来工作:

<dependency>
    <groupId>org.roboguice</groupId>
    <artifactId>roboguice</artifactId>
    <version>2.0-SNAPSHOT</version>
    <scope>compile</scope>
    <exclusions>
        <exclusion>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v4</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Thanks to @dma_k, it worked by adding the following "exclusion" tag and by removing the "compatibility-v4" dependency:

<dependency>
    <groupId>org.roboguice</groupId>
    <artifactId>roboguice</artifactId>
    <version>2.0-SNAPSHOT</version>
    <scope>compile</scope>
    <exclusions>
        <exclusion>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v4</artifactId>
        </exclusion>
    </exclusions>
</dependency>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文