相关疑难解决方法(0)

缺少项目的POM,没有可用的依赖项信息

背景

尝试使用Java 1.7的干净安装Apache Maven 3.1.0将Java库添加到本地Maven存储库.以下是添加Java归档文件的方法:

mvn install:install-file \
  -DgroupId=net.sourceforge.ant4x \
  -DartifactId=ant4x \
  -Dversion=0.3.0 \
  -Dfile=ant4x-0.3.0.jar \
  -Dpackaging=jar
Run Code Online (Sandbox Code Playgroud)

这创建了以下目录结构:

$HOME/.m2/repository/net/sourceforge/ant4x/
??? 0.3.0
?   ??? ant4x-0.3.0.jar.lastUpdated
?   ??? ant4x-0.3.0.pom.lastUpdated
??? ant4x
    ??? 0.3.0
    ?   ??? ant4x-0.3.0.jar
    ?   ??? ant4x-0.3.0.pom
    ?   ??? _remote.repositories
    ??? maven-metadata-local.xml
Run Code Online (Sandbox Code Playgroud)

项目的pom.xml文件引用依赖项目(上面的树),如下所示:

<properties>
  <java-version>1.5</java-version>
  <net.sourceforge.ant4x-version>0.3.0</net.sourceforge.ant4x-version>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
<dependency>
  <groupId>net.sourceforge</groupId>
  <artifactId>ant4x</artifactId>
  <version>${net.sourceforge.ant4x-version}</version>
  <scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)

问题

运行后mvn compile,返回以下错误(完全登录Pastebin):

[ERROR] Failed to execute goal on project ant4docbook: Could not resolve dependencies for project net.sourceforge:ant4docbook:jar:0.6-SNAPSHOT: Failure …
Run Code Online (Sandbox Code Playgroud)

java compilation build pom.xml maven

46
推荐指数
1
解决办法
13万
查看次数

"POM for ...缺失,没有可用的依赖信息",即使它存在于Maven资源库中

问题:

即使我从Maven存储库复制了依赖项,依赖项也不会下载.

当我将鼠标悬停在Eclipse中的依赖项时,它会发出警告:" Maven Missing artifact org.raml:jaxrs-code-generator:jar:2.0.0".

当我尝试mvn installmvn compile它警告:" [WARNING] The POM for org.raml:jaxrs-code-generator:jar:2.0.0 is missing, no dependency information available".

尝试:

  • jar下载到~/.m2/repository/org/raml/jaxrs-code-generator/2.0.0文件夹中,然后在编辑器中刷新.

    • 当我installcompile它似乎忽略它.
  • 运行mvn -U.

    • install或相同compile.

深入:

    <dependency>
        <groupId>org.raml</groupId>
        <artifactId>jaxrs-code-generator</artifactId>
        <version>2.0.0</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)
  • 依赖存在Maven存储库中(版本也是正确的).

  • 使用Eclipse EE Neon 4.6.3,Apache Maven 3.3.9,Java 1.8.0_121.

  • 我没有settings.xml~/.m2文件夹中.

  • 我不使用本地或其他任何其他存储库.

java eclipse maven

20
推荐指数
3
解决办法
5万
查看次数

如何将Robolectric,Maven,ActionBarSherlock(最好是+ IntelliJ)集成到Android项目中?

我一直在撞墙一段时间试图让maven,robolectric,actionbar sherlock和intellij,所有人都玩得很好.我现在已经放弃了使用intellij构建并且专注于maven.

当我跳过maven构建中的测试时,我有一个带有操作栏的应用程序(这告诉我,我很高兴继续使用ActionBar集成前端).IntelliQ构建在ManifestParsingTest.java上失败,抱怨它不知道junit在哪里(以及其他问题).

Robolectric集成

我已经在项目中成功运行了Robolectric.我将Jake Wharton的要点中的文件复制到了src/test/java/com/blah/blah/support/(除了ShadowSherlockFragmentActivity.java它存在src/test/java/com/blah/blah/support/shadows/)并将此行放在我的自定义测试运行器的构造函数中(位于support文件夹中):

ActionBarSherlock.registerImplementation(ActionBarSherlockRobolectric.class);
Run Code Online (Sandbox Code Playgroud)

mvn错误

我遇到了这些构建错误(IntelliJ也有相同的红色波浪形):

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project Blah: Compilation failure: Compilation failure:
[ERROR] /Users/clatislaw/Documents/Code/Android/projectName/src/test/java/com/blah/blah/support/SherlockResourceLoader.java:[29,9] cannot find symbol
[ERROR] symbol  : constructor ResourceLoader(int,java.lang.Class,java.util.List<java.io.File>,java.io.File)
[ERROR] location: class com.xtremelabs.robolectric.res.ResourceLoader
[ERROR] /Users/clatislaw/Documents/Code/Android/projectName/src/test/java/com/blah/blah/support/SherlockResourceLoader.java:[45,5] method does not override or implement a method from a supertype
[ERROR] /Users/clatislaw/Documents/Code/Android/projectName/src/test/java/com/blah/blah/support/ActionBarSherlockTestRunner.java:[39,37] resourceLoaderForRootAndDirectory has private access in com.xtremelabs.robolectric.RobolectricTestRunner
[ERROR] /Users/clatislaw/Documents/Code/Android/projectName/src/test/java/com/blah/blah/support/ActionBarSherlockTestRunner.java:[47,30] cannot find symbol
[ERROR] symbol  : method getResourcePath()
[ERROR] location: …
Run Code Online (Sandbox Code Playgroud)

android intellij-idea maven robolectric actionbarsherlock

12
推荐指数
1
解决办法
2262
查看次数

如何从 Sonatype 获取快照

我正在尝试获取可用于org.atmosphere但似乎无法获取的气氛的快照版本......

<repositories>
    <!-- Added to get the Atmosphere 1.1.0-SNAPSHOT, can be removed when 1.1.0 is released -->
    <repository>
        <id>oss.sonatype.org-snapshot</id>
        <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        <releases><enabled>false</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
    </repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)

似乎没有通过添加新存储库来获取大气版本。

<dependency>
    <groupId>org.atmosphere</groupId>
    <artifactId>atmosphere-runtime</artifactId>
    <version>1.1.0-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)

主要气氛开发人员告诉我这应该可行

maven atmosphere

2
推荐指数
1
解决办法
6252
查看次数

maven 无法下载 jacoco 0.7.10-SNAPSHOT jar

我对此感到困惑。我的 pom.xml 中有这个

<build>
    <pluginManagement>
        ... other plugins ...
        <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
           <version>0.7.10-SNAPSHOT</version>
        </plugin>
    </pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)

这是我的存储库部分

<repositories>
    <repository>
        <id>oss-sonatype</id>
        <name>oss-sonatype</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <updatePolicy>daily</updatePolicy>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    ..... other repositories ....        
</repositories>
Run Code Online (Sandbox Code Playgroud)

据我所知,jacoco-0.7.10-SNAPSHOT 存在于https://oss.sonatype.org/content/repositories/snapshots/org/jacoco/jacoco-maven-plugin/0.7.10-SNAPSHOT/

我的理解是应该下载它并构建应该成功但我收到以下错误

[错误] 插件 org.jacoco:jacoco-maven-plugin:0.7.10-SNAPSHOT 或其依赖项之一无法解析:找不到工件 org.jacoco:jacoco-maven-plugin:jar:0.7.10-SNAPSHOT -> [帮助 1]

我看到了人们建议在 ~/.m2/settings.xml 文件中添加存储库的解决方案。我想知道我可以在不更改 .m2/settings.xml 的情况下执行此操作,以及为什么当前设置不起作用。非常感谢任何提示。

PS如果这已经在某处得到了回答,请原谅我。我还没有找到解决办法。

java dependency-management maven-plugin maven

2
推荐指数
1
解决办法
3682
查看次数