2011-02-24 62 views
11

我升级到使用嵌入式maven 3的netbeans 7.我有一个包含很多模块和包含其他模块的模块的项目。我不依赖于内部项目的其他子模块可以在相同的配置下正常工作。在这种情况下,spring-hibernate依赖于作为子模块之一的域并失败。maven 3无法读取工件描述符

我的主要项目有这样的事情

<modelVersion>4.0.0</modelVersion> 

<artifactId>spring</artifactId> 
<packaging>pom</packaging> 

<groupId>${masterproject.groupId}</groupId> 
<version>${masterproject.version}</version> 

我的子模块具有我使用下面的$ {} masterproject.groupId $ {} masterproject.version由于以下DEF

<modelVersion>4.0.0</modelVersion> 
<parent> 
    <artifactId>spring</artifactId> 
    <groupId>${masterproject.groupId}</groupId> 
    <version>${masterproject.version}</version> 
</parent> 

<artifactId>spring-hibernate</artifactId> 
<packaging>pom</packaging> 

<dependency> 
     <groupId>${masterproject.groupId}</groupId> 
     <artifactId>domain</artifactId> 
</dependency> 

我不想将静态值放在所有子模块中,因为每个子模块都包含一个父模块。不确定这是否是问题的原因。

所有这一切工作正常使用Maven 2.但与Maven 3我收到以下错误味精

Failed to read artifact descriptor for com.merc:domain:jar:1.0-SNAPSHOT: Failure to find ${masterproject.groupId}:MavenMasterProject:pom:${masterproject.version} in http://repository.springsource.com/maven/bundles/release was cached in the local repository, resolution will not be reattempted until the update interval of com.springsource.repository.bundles.release has elapsed or updates are forced -> [Help 1] 
+1

不,我更新了pom.xml以使用类似snapshot-1.0的静态值。但想使用属性,而不是 – user373201 2011-10-07 18:42:06

回答

0

一种可能是你在profiles.xml​​和masterproject.version指定的值。如果是这样,那么在maven3中是no longer supported

8

我在Eclipse中有这个,这样做,其中固定它(即使我的命令行构建工作)

  1. 删除.m2目录/ repostiory目录/ ....
  2. 运行更新的依赖关系我的IDE

mvn命令行工作,而我的IDE没有,一旦我在我的IDE运行它都工作..很奇怪。

作为另一种选择, 。重新启动Eclipse似乎有所帮助

+0

我有同样的问题,这种解决方案为我工作。令人沮丧的是,我的IDE(netbeans)和CL maven在彼此的脚趾上踩了一脚......我习惯于从终端上做大多数mvn和svn的东西,但是当我清理并构建了w/dependencies时,一切又开始工作了。 .. – b3bop 2012-02-21 22:45:43

+0

是的,我更喜欢常春藤,并将jar复制到输出/库中,所以不必使用m2eclipse插件,这在过去的6年中似乎有问题,我已经使用它。 – 2012-02-27 16:04:46

+0

有趣的是你提到m2eclipse。其实它是我从eclipse切换到netbeans的原因。我真的很喜欢maven(或者更确切地说,我非常喜欢maven的想法,有时候真的让我很失望),netbeans也有杀手maven的支持。 – b3bop 2012-02-28 03:17:23

0

该消息,尤其是Failure to find一部分,意味着你缺乏相应的财产在pom.xml文件中的描述:

<properties> 
    <masterproject.version>the.appropriate.version</masterproject.version> 
</properties> 

并且要小心:这样的错误可能引起许多依赖性错误!

0

我有同样的问题,maven不喜欢有一个非常量(即属性)父版本。

试试你的父元素更改为:

<parent> 
    <artifactId>spring</artifactId> 
    <groupId>${masterproject.groupId}</groupId> 
    <version>1.0-SNAPSHOT</version> 
</parent> 

显然,它并没有为1.0-SNAPSHOT它只是必须有一些静态版本。

希望这会有所帮助。

相关问题