Question

I cannot import a maven project with WTP features enabled.

I have already tried:

mvn -Dwtpversion=R7 eclipse:eclipse

When I did the import, the WTP features are not enabled.

How do I import with the features enabled?

Was it helpful?

Solution

Does the maven-eclipse-plugin generate the .wtpmodules file as expected? This is what I get when running the same command on a war project:

$ mvn -Dwtpversion=R7 eclipse:eclipse
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'eclipse'.
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-eclipse-plugin-wtp-testcase
[INFO]    task-segment: [eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
[INFO] No goals needed for project - skipping
[INFO] [eclipse:eclipse {execution: default-cli}]
[INFO] Adding support for WTP version R7.
[INFO] Using Eclipse Workspace: null
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER
[INFO] Not writing settings - defaults suffice
[INFO] Wrote Eclipse project for "maven-eclipse-plugin-wtp-testcase" to /home/pascal/Projects/maven-eclipse-plugin-wtp-testcase.
[INFO] 
       Javadoc for some artifacts is not available.
       Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote repositories for javadoc.
       List of artifacts without a javadoc archive:
         o junit:junit:3.8.1

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Tue Oct 27 22:49:17 CET 2009
[INFO] Final Memory: 9M/79M
[INFO] ------------------------------------------------------------------------
$ ls -a
.  ..  .classpath  pom.xml  .project  src  .wtpmodules
$ cat .wtpmodules 
<project-modules id="moduleCoreId">
  <wb-module deploy-name="maven-eclipse-plugin-wtp-testcase">
    <module-type module-type-id="jst.web">
      <version>2.4</version>
      <property name="context-root" value="maven-eclipse-plugin-wtp-testcase"/>
    </module-type>
    <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/>
  </wb-module>
$ 

On my environment, the eclipse plugin seems seems to be working fine.

That said, WTP R7 (0.7) is quite old (it was released in July 2005) and may not be the right version for your configuration. According to the Web Tools Platform downloads page, WTP 0.7 and WTP 1.0 goes with Eclipse 3.1, WTP 1.5 goes with Eclipse 3.2, WTP 2.0 goes with Eclipse 3.3, WTP 2.1 and WTP 3.0 goes with Eclipse 3.4, WTP 3.1 goes with Eclipse 3.5.

So the question is: what versions of Eclipse and of the WTP are you running?

The plugin actually can create WTP R7, 1.0, 1.5 and 2.0 configuration files as mentioned on the WTP Support page (2.0 is currently missing in the documentation of the wtpversion optional parameter but this is a documentation bug, see MECLIPSE-434). I've successfully imported a generated WTP 2.0 project in Eclipse 3.5.1 + WTP 3.1 so using 2.0 should be ok for recent versions of Eclipse (regardless of MECLIPSE-559).

Note: If you don't want to pass the wtpversion on the command line, you can set it in the maven-eclipse-plugin configuration in your pom.xml like this:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-eclipse-plugin</artifactId>
      <configuration>
        <wtpversion>2.0</wtpversion>
        ...
      </configuration>
    </plugin>

OTHER TIPS

Don't forget to run a

mvn eclipse:clean eclipse:eclipse

To remove the previously created eclipse wtp configuration files

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top