Fork me on GitHub

What is Apache Turbine Webapp?

Turbine Webapp is a Maven Archetype to generate a skeleton Turbine application.

Prerequisites

The archetype sets up a new application using MySQL as the default database store. However, you can adjust this to use any database supported by Apache Torque 7.x.

If not using Docker, you should therefore be at least have a database instance where you have access rights to create a new database schema and populate it with the tables the application generates.

Finally, this is a maven archetype, so of course you should install a local version of Maven.

Read on to understand more about general structuring or continue reading here and follow instructions.

How to find the Maven archetype

If you want to build the Turbine Webapp yourself and install it automatically in your local archetyp catalog, see next section

As explained in How does the Archetype Plugin know about archetypes? you may have already a local catalog or you find the archetype in the remote catalog, by default archetype-catalog.xml.

For example, if you provide the FQN groupid:artifactid in the filter argument the following command will search in the remote (and local) cataloges:

 mvn archetype:generate -Dfilter=org.apache.turbine:turbine-webapp-7.0 -DarchetypeCatalog=remote

If you want to check only the remote catalog you have to set additionally an (non activated) profile in .m2/settings.xml (or a local version), like it is explained here.

Example profile in settings.xml setting up a profile with the remote catalog:

   <profiles>
..
<profile>
  <id>remote-archetype</id>
   <repositories>
    <repository>
        <id>archetype</id>
        <url>https://repo.maven.apache.org/maven2/</url>
      </repository>
     </repos>
   </profile>  
   ..   
     </profiles>   

Then you can invoke it like this by activating the profile , and only the remote catalog will be checked:

 
mvn archetype:generate -Dfilter=org.apache.turbine:turbine-webapp-7.0 -DarchetypeCatalog=remote -Premote-archetype

Following is an example output:

  
$ mvn archetype:generate -Dfilter=org.apache.turbine:turbine-webapp-6.0 -Premote-archetype
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> archetype:3.4.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< archetype:3.4.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- archetype:3.4.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> org.apache.turbine:turbine-webapp-6.0 (This archetype sets up a web application project based on Apache Turbine 6.x and Torque 5.2.x)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : Choose archetype:

// ... after selecting number 1

Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
[INFO] Using property: turbine_app_name = My Turbine Web Application
[INFO] Using property: turbine_intake_file = intake.xml
[INFO] Using property: turbine_database_name = turbine
[INFO] Using property: turbine_database_adapter = auto
[INFO] Using property: turbine_database_jndipath = jdbc/turbine
[INFO] Using property: turbine_database_driver = com.mysql.cj.jdbc.Driver
[INFO] Using property: turbine_database_url = jdbc:mysql://localhost:3306/
[INFO] Using property: turbine_database_timezone = UTC
[INFO] Using property: turbine_database_user = db_user
[INFO] Using property: turbine_database_password = db_password
Define value for property 'app_volume_local_repo' ${settings.localRepository}:
..
        
After this, the new Turbine Webapp project will be in a folder named like the name you set as project artifactid.

For further information, check in the generated project in subfolder docs/README.md or follow the instructions here.

Build: Where do I get the Turbine Webapp archetype?

Download the current main release of Turbine webapp through the Apache mirror system at the turbine maven download site or clone it from git repository selecting the appropriate tag.

After download it you usually want to build it, which will as the last step autmatically add the archetpye to the locale archetype-catalog.xml.

After the build, you could generate the Turbine Webapp from the local archetype repository like with this command:

mvn archetype:generate -DarchetypeCatalog=local -U 
Find more informations about archetype catalog types here.

Development: Where do I get the Turbine Webapp source code?

Find the source of Turbine Webapp Maven Archetype on GitHub.

See also the blog post in the Turbine Blog for usage information.