小编典典

Maven依赖关系

Maven-2

我正在运行一个依赖groovy 1.7-beta-1的项目。gmaven插件使用groovy 1.6版作为依赖项。在pom中,我在依赖性管理部分中将grooyv-all版本指定为:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>1.7-beta-1</version>
        </dependency>
    </dependencies>
</dependencyManagement>

但是,当我在调试模式下运行maven时,我看到groovy 1.6被用于对gmaven插件的依赖。我以为我的依赖项管理部分会重写此设置,因此它们都使用1.7-beta-1,但是由于常规版本不同,我遇到了错误。这里的任何帮助将不胜感激。

谢谢,


阅读 385

收藏
2020-09-25

共1个答案

小编典典

这是Pascal答案的精炼版。我将主插件版本升级为1.2,将对Groovy 1.7的依赖项升级到了pluginManagement标记中,以便很好地利用继承模型。

请记住,GMaven插件的1.3-SNAPSHOT已经开始使用1.7-rc2 Groovy提供程序。

<!-- I wrapped everything in a plugin management section so that this can be neatly inherited across all your poms -->
<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.codehaus.gmaven</groupId>
      <artifactId>gmaven-plugin</artifactId>
      <!-- Notice I upgraded it to 1.2 -->
      <!-- Details here http://repo1.maven.org/maven2/org/codehaus/gmaven/gmaven-plugin/1.2/gmaven-plugin-1.2.pom -->
      <version>1.2</version>
      <dependencies>
        <dependency>
          <groupId>org.codehaus.gmaven.runtime</groupId>
          <artifactId>gmaven-runtime-1.7</artifactId>
          <version>1.2</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</pluginManagement>
2020-09-25