maven依赖groovy

Jef*_*rey 6 groovy dependencies maven-2 dependency-management

我正在运行一个依赖于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>
Run Code Online (Sandbox Code Playgroud)

然而,当我在调试模式下运行maven时,我看到groovy 1.6被用于对gmaven插件的依赖.我认为我的依赖管理部分会覆盖它,所以他们都使用1.7-beta-1,但由于不同的groovy版本我得到错误.任何帮助在这里将不胜感激.

谢谢,

杰夫

Mat*_*ugh 7

这是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>
Run Code Online (Sandbox Code Playgroud)