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

前端 未结 4 1836
说谎
说谎 2020-12-16 04:40

I created a web project with maven like this:

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-web

相关标签:
4条回答
  • 2020-12-16 05:08

    You should explicitly mention in your pom.xml that the maven-eclipse-plugin should generate a WTP-project. A simple example, which should be in your pom.xml at the build-part, would be:

    <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>
    </plugins>
    
    0 讨论(0)
  • 2020-12-16 05:11

    Did you jump from the create command to the eclipse:eclipse command?

    Check out this link. You need to edit your POM first, then call "mvn clean package". After you do that, THEN try the "mvn eclipse:eclipse".

    0 讨论(0)
  • 2020-12-16 05:12

    You can also use mvn eclipse:eclipse -Dwtpversion=2.0 to generate all WTP meta-data for the project without changing the POM.

    Of course, you'd have to change the WTP version if you are using an older version of Eclipse.

    0 讨论(0)
  • 2020-12-16 05:15

    Just install a development version of m2eclipse and your project will be used as a maven project, no need to do mvn eclipse:eclipse or anything like that. I use it and works.

    http://m2eclipse.sonatype.org/

    0 讨论(0)
提交回复
热议问题