【发布时间】:2015-07-23 04:43:46
【问题描述】:
我正在尝试使用 groovy 创建一个 maven 插件。我想使用 groovy 1.8 或更高版本。
我已经关注了these instructions,如果我使用的话,一切都会顺利进行:
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0-rc-4</version>
这构建了我的插件,我可以在其他项目中使用它。
但是,这提供了旧版本的 groovy (1.5.7)。要切换到较新版本,我尝试使用新版本和 providerSelection:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<providerSelection>1.8</providerSelection>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.8</artifactId>
<version>1.5</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
但是当我构建我的插件时,我收到了警告:
[WARNING] Deprecation Alert:
[WARNING] No mojo descriptors were found in this project which has a packaging type of maven-plugin.
[WARNING] In future versions of the plugin tools, this will fail the build.
[WARNING] If this project is an archetype, change the packaging type from maven-plugin to maven-archetype.
当我尝试使用我的插件时,maven 根本不会调用我的插件;我猜这是因为缺少插件描述符。
有没有人能够使用 groovy 成功构建一个 1.8 或更高版本的 maven 插件?
PS:我也查看了 groovy-eclipse-compiler 插件而不是 gmaven,但我似乎总是收到上面的警告。
【问题讨论】:
标签: maven groovy maven-plugin gmaven-plugin