1
votes

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
just use maven 2.1 for this project. You can try editing the pom of gwt-maven-plugin (section: <mavenVersion>2.0.9</mavenVersion> and change it to 3.0.whatever) - wouldn't recommend it though. - hovanessyan
Also checkout the maven-ant-task dependencies: maven.apache.org/ant-tasks/index.html - seems like officially is not supporting Maven 3 pom file processing. - hovanessyan
Really, I don't understand. I've been using Maven 3.x for a couple years and never had any such problem with the gwt-maven-plugin. - Thomas Broyer

1 Answers

6
votes

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>