Search code examples
javaapachemavenstruts2struts

How to Create Stuts2 Project using Maven


In the official doc by Apache Struts, they mentioned this:

"In your Java IDE create a Java web application with a project name of basic_struts that follows the standard Maven project folder structure"

What does that mean?

  1. Does it mean, create a Maven project? (but that doesn't seemlike a web project)
  2. Create a Dynamic Web Project? (But how do I use Maven? I'll be using a pom.xml file as mentioned in the guide)

How to create Struts 2 application using Maven?


Solution

  • You can create struts2 project by choosing this archetype

    org.apache.struts:struts2-archetype-starter
    

    You can get more information about Maven archetypes on the struts site.

    The Starter Archetype (struts2-archetype-starter) The Starter archetype creates a more featured application using several common technologies used in production applications.

    Features

    Sitemesh integration

    Action example (instantiated both through Spring and Struts)

    Spring integration

    Validation example (action and action-alias level)

    Conversion example (global and action level)

    Resource bundle (both global, action and package level)

    mvn archetype:generate -B -DgroupId=com.mycompany.mysystem \ -DartifactId=myWebApp \ -DarchetypeGroupId=org.apache.struts \ -DarchetypeArtifactId=struts2-archetype-starter