Search code examples
eclipsemavengwtgwtquery

How would you add maven to an existing GWT project in Eclipse with m2e installed?


The project has GWTQuery included. I'd like to have the pom.xml generated in the existing project so I can configure the build.


Solution

  • The best way I see is to create a new maven-ready project using gwtquery archetype and setting the same namespaces and module name that you use in your current project.

    mvn archetype:generate  -DarchetypeGroupId=com.googlecode.gwtquery \
                            -DarchetypeArtifactId=gquery-archetype  \
                            -DarchetypeVersion=1.3.3 \
                            -DgroupId=com.mycompany \
                            -DartifactId=myproject \
                            -DprojectName=MyProject 
    

    Then import the maven project in eclipse (use m2e plugin) and check if it works (dev mode, tests, etc).

    Copy all your source code from your src folder to the new project src/main/java, the same with your public stuff, .gwt.xml file, and tests.

    And finally add your dependencies to your pom using the eclipse pom editor.

    Note: The m2e feature of converting a normal eclipse project to maven needs a lot of work.