2

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

[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

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

4

3 回答 3

5

如果您将其放入该dependencyManagement部分,而不是将其放入该部分,则它会起作用dependencies

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

所有版本都在工作。当我把它放在 dependencies部分而不是dependencyManagement部分时,我得到了同样的错误。您无需手动操作。

于 2012-11-22T09:57:04.550 回答
2

在您的 pom.xmldependencyManagement部分下添加:

<project>
 ...
 <dependencyManagement>
  <dependencies>
  ...
   <dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-nodep</artifactId>
    <version>2.1_3</version>
    </dependency>
  ....
于 2011-05-22T12:22:03.797 回答
1

cglib 版本 2.1_3 已从主 maven 存储库中删除以支持 2.2.2
尝试将您的依赖项更新到 2.2.2 - 谁知道,也许它会工作:)
如果没有,请下载 2.1_3(从这里示例)并在本地手动安装。

于 2011-05-22T12:50:10.500 回答