首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >ActionBarSherlock + maven + eclipse:在工作区中找不到依赖项

ActionBarSherlock + maven + eclipse:在工作区中找不到依赖项
EN

Stack Overflow用户
提问于 2012-08-21 02:43:26
回答 5查看 9.3K关注 0票数 18

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

dependency=[com.actionbarsherlock:library:apklib:4.1.0:compile] not found in workspace

在以前的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>

编辑:

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

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2012-08-21 15:28:30

从Android 0.4.2开始,您现在需要在Eclipse工作区中修改Android库项目,以便m2e-android能够成功检测到它们。ActionBarSherlock的POM可以在以下位置找到:

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

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

票数 10
EN

Stack Overflow用户

发布于 2013-10-26 04:31:24

对于那些不知道"MAVENIZED“是什么意思的人来说,它是将一个简单的项目转换成一个Maven项目。

在Eclipse中,右键单击您的项目,配置Maven Convert to -> project

票数 2
EN

Stack Overflow用户

发布于 2012-12-01 05:16:31

只有在通过配置文件使用eclipse时,才能将actionbarsherlock依赖项作为jar文件包含在内。

<profile>
  <id>m2e</id>
  <activation>
    <property><name>m2e.version</name></property>
   </activation>
   <dependencies>
    <dependency>
      <groupId>com.actionbarsherlock</groupId>
      <artifactId>actionbarsherlock</artifactId>
      <version>${abs.version}</version>
      <type>jar</type>
    </dependency>
  </dependencies>
</profile> 

并且不需要将整个actionbarsherlock作为项目包含在eclipse中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12043237

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档