Search code examples
eclipsemavenmaven-3m2eclipsem2e

WTP dependency does not seem to be working


From reading A Java web project created with Maven is not recognized as such by Eclipse

I add the below plugin to pom.xml to convert my maven project to a web project :

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

I then run "Update Project Configuration" but the maven project is not converted to a web project.

If I run the command mvn eclipse:eclipse -Dwtpversion=2.0 the project is then updated. Should updating the .pom file not suffice to convert the maven project to a web project ?


Solution

  • It will not suffice. The plugin configuration needs to be executed, which will not happen by just loading/refreshing it in Eclipse. It gets executed when mvn eclipse:eclipse is run.

    I assume we do not have m2e, which does not need this configuration anway.