问题
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.
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] Error resolving version for 'org.codehaus.mojo:gwt-maven-plugin': Plugin requires Maven version 2.1
My plugin defn:
<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>
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>
- Do I have to install maven 2.1?
- or, is there a way to force it to use maven 3.x?
- or, am I missing a piece of info in the config?
回答1:
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>
来源:https://stackoverflow.com/questions/12323955/gwt-maven-plugin-plugin-requires-maven-version-2-1