Java Dynamic Web project with Maven and Eclipse

前端 未结 4 2100
温柔的废话
温柔的废话 2020-12-12 16:32

I have several questions about creating a Java Web application with Maven and Eclipse:

  • How do I create a Java web project with servlets, jsp, and other classes
4条回答
  •  星月不相逢
    2020-12-12 17:02

    You should create a project based on the webapp Maven archetype, not the default one you're using.

    I'm using SpringSource Tool Suite, which, for this exercise, is the same as Eclipse with m2e. Create a new Maven project and make sure you select the following archetype:

    enter image description here

    The Maven the command-line way of doing this is:

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

    This archetype will put the WEB-INF folder in the correct location (under src/main/webapp).

    You can find more information at http://maven.apache.org/guides/mini/guide-webapp.html

提交回复
热议问题