gwt-maven-plugin:插件需要 Maven 2.1 版 [英] gwt-maven-plugin: Plugin requires Maven version 2.1
问题描述
我正在尝试使用 gwt-maven-plugin 来编译我的项目.我的 spring 工具套件 eclipse 4.2 中安装了 Maven 3.0.3.
I am trying to use gwt-maven-plugin to compile my project. I have Maven 3.0.3 installed in my spring tool suite eclipse 4.2.
然而,插件咕噜咕噜地想用maven 2.1.我确定使用 maven 3.x 应该没有问题,对吧??
However, the plugin croaks that it wants to use maven 2.1. I am sure it should have no problems using maven 3.x, right??
[artifact:mvn] [INFO] 'org.codehaus.mojo:gwt-maven-plugin' 版本解析错误:插件需要 Maven 2.1 版
[artifact:mvn] [INFO] Error resolving version for 'org.codehaus.mojo:gwt-maven-plugin': Plugin requires Maven version 2.1
我的插件定义:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<configuration>
<module>ally.mc.beal</module>
<gen>gwt-generated</gen>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
我用来触发 gwt 编译的 ant 目标:
My ant target I used to trigger the gwt compile:
<project name="AllyMcBeal"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<path id="maven-ant-tasks.classpath" path="maven/maven-ant-tasks-2.1.3.jar" />
...
<target name="gwt.compile">
<artifact:mvn>
<arg value="gwt:compile" />
</artifact:mvn>
</target>
...
</project>
- 我是否必须安装 maven 2.1?
- 或者,有没有办法强制它使用 maven 3.x?
- 或者,我是否在配置中遗漏了一条信息?
推荐答案
您需要设置 artifact:mvn
ant 任务的 mavenVersion
属性.如果没有这个,任务默认为 2.0.10 的 Maven 版本,这会导致您看到的错误消息.
You need to set the mavenVersion
attribute of the artifact:mvn
ant task. Without this the task defaults to a maven version of 2.0.10 which causes the error message you are seeing.
作为参考,我的任务如下所示:
For reference my task looks like this:
<artifact:mvn pom="mypomfilepath.xml" mavenVersion="3.0.4">
<arg value="install"/>
</artifact:mvn>
这篇关于gwt-maven-plugin:插件需要 Maven 2.1 版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!