android - ActionBarSherlock + maven + eclipse : dependency not found in workspace

标签 android eclipse maven actionbarsherlock m2e

我已更新到最新版本的 ADT 插件,但遇到了 this issue ,解决了更新 m2e-android eclipse 插件的问题。现在,我可以通过控制台编译我的项目,但不能使用 Eclipse。这是eclipse中pom.xml文件抛出的异常:

dependency=[com.actionbarsherlock:library:apklib:4.1.0:compile] 在工作区中找不到

在以前版本的 ADT/m2e-android 中,我能够毫无问题地构建控制台和 eclipse。

有谁知道如何解决这个问题?也许我的 pom.xml 错了?

感谢您的宝贵时间。


目前使用:

  • Eclipse classic 3.7.2(Juno 问题依然存在)
  • ADT 20.0.3
  • m2e-android 0.42
  • android-maven-plugin 3.3.0
  • maven 3.0.4
  • m2e 1.1.0(作为依赖项包含在 m2e-android 0.42 中)

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.jelies</groupId>
    <artifactId>my-project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>

    <dependencies>
        <dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>4.1_r2</version>
            <scope>provided</scope>
        </dependency>

        <!-- some unrelated dependencies -->

        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>library</artifactId>
            <version>4.1.0</version>
            <type>apklib</type>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <sdk>
                        <platform>16</platform>
                    </sdk>
                    <emulator>
                        <avd>avd-4.1</avd>
                    </emulator>
                    <deleteConflictingFiles>true</deleteConflictingFiles>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>eclipse</id>
            <activation>
                <!-- This profile is only activated when m2e.version is present (only 
                    in eclipse) -->
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.google.android</groupId>
                    <artifactId>support-v4</artifactId>
                    <version>r7</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>

编辑:

答案是正确的。在我的工作区中 mavenized ABS 库项目,错误消失了!但是,出现了另一个问题:我的项目中添加了ABS传递依赖项,导致eclipse无法启动应用程序。这是一个已知问题,您可以关注 here .

最佳答案

从 Android 0.4.2 开始,您现在需要在 Eclipse 工作区中对 Android 库项目进行 mavenise,以便 m2e-android 成功检测到它们。 ActionBarSherlock 的 POM 可以在这里找到:

https://github.com/JakeWharton/ActionBarSherlock/blob/master/library/pom.xml#

注意: m2e-android 是测试版软件,因此可能会在不同版本之间发生可能影响功能的更改。

关于android - ActionBarSherlock + maven + eclipse : dependency not found in workspace,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12043237/

相关文章:

android - 如何自定义 com.facebook.widget.LoginButton 的用户界面

javascript - 如何更改 Eclipse 以在 Javascript 编辑器中使用空格而不是制表符?

eclipse - maven-dependency-plugin:在 Eclipse 中解压失败

maven - 在多模块 Maven 构建中重用 ant-snippets

maven - 通过解析 Maven 存储库中的 Tycho 特性来构建 p2 存储库

maven - tomcat 上的 nexus 停止响应 - 此存储库管理器的替代方案

android - unity android wifi socket通信通过Android DLL

android - 编写和读取 XML 的最简单方法

java - 安装插件后无法在 Spring Tool Suite 3.6.1 中找到 Hibernate Tools

java - Android - TextView 上的 NullPointerException