Maven - 无法解析工件 - cglib:cglib-nodep:jar:null

时间:2011-05-22 12:17:56

标签: maven cglib

我正在尝试构建一个大型项目,并且失败并出现以下错误:

[INFO] ------------------------------------------------------------------------
[INFO] Building Utilities
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1255 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 16 resources
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Couldn't find a version in [2.2.2] to match range [2.1_3,2.1_3]
  cglib:cglib-nodep:jar:null

from the specified remote repositories:
  java.net (http://download.java.net/maven/2),
  internal (http://repo.some-project.org/maven),
  central (http://repo1.maven.org/maven2)

Path to dependency:
        1) org.some-project:util:jar:1.5.0

found并下载cglib-nodep-2.1_3.jar
由于我缺乏使用maven的经验,我不确定如何(hrr ...)使构建过程使用此文件而不是失败(我猜)从互联网上获取它。

3 个答案:

答案 0 :(得分:5)

如果您放入dependencyManagement部分,而不是将其放入dependencies部分,则此功能正常。

<dependencyManagement>
   <dependencies>
      <dependency>     
        <groupId>cglib</groupId>     
        <artifactId>cglib-nodep</artifactId>     
        <version>2.1_2</version> 
      </dependency>     
   </dependencies>
</dependencyManagement>

所有版本都有效。当我把它放在dependencies部分而不是dependencyManagement部分时,我收到了同样的错误。你不需要这样做  手动

答案 1 :(得分:2)

dependencyManagement部分下的pom.xml中添加:

<project>
 ...
 <dependencyManagement>
  <dependencies>
  ...
   <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-nodep</artifactId>
    <version>2.1_3</version>
    </dependency>
  ....

答案 2 :(得分:0)

cglib版本2.1_3已从主maven仓库中删除,转而支持2.2.2 尝试将您的依赖关系更新为2.2.2 - 谁知道,也许它会起作用:) 如果没有,请在本地下载2.1_3(例如here)和manually install