This is a collection of archetypes I use, for example a Jakarta EE one.
This should be obvious but in case you don't know, this project requires:
- JDK 8 or newer
- Maven 3.1 or newer
- Docker 19 or newer
To install the archetypes checkout the repository and install them:
$ git clone https://github.com/cwansart/maven-archetypes.git
$ cd maven-archetypes
$ mvn clean installThe Jakarta EE archetype contains a sample project with a JAX-RS-based resource.
It creates a sample unit test and an integration test. To run the server it
uses the liberty-maven-plugin though it works on any Jakarta EE 8 compatible
enterprise server.
There are several property that may be set via -D<property>=<value>:
| Property | Description | Default value |
|---|---|---|
| package | the package name | ${groupId}.${artifactId} |
| openLibertyVersion | Open Liberty runtime version | 20.0.0.3 |
| jakartaeeApiVersion | Jakarta EE api version | 8.0.0 |
| slf4jVersion | Slf4j version | 1.7.30 |
| junitVersion | JUnit 4 version | 4.13 |
| testcontainersVersion | Testcontainers version | 1.13.0 |
| restAssuredVersion | Rest Assured version | 4.3.0 |
| surefirePluginVersion | Surefire plugin version | 3.0.0-M4 |
| failsafePluginVersion | Failsafe plugin version | 3.0.0-M4 |
To create a project based on the archetype:
$ mvn archetype:generate -DarchetypeCatalog=local \
-DarchetypeGroupId=de.cwansart.archetypes \
-DarchetypeArtifactId=jakartaeeAfter creating you can run tests and run the application via Maven:
$ mvn clean verify
$ mvn liberty:runThe MicroProfile archetype contains a sample project with a JAX-RS-based
resource. It creates a sample unit test and an integration test. To run the
server it uses the liberty-maven-plugin though it works on any MicroProfile
compatible enterprise server.
There are several property that may be set via -D<property>=<value>:
| Property | Description | Default value |
|---|---|---|
| package | the package name | ${groupId}.${artifactId} |
| openLibertyVersion | Open Liberty runtime version | 20.0.0.3 |
| microProfileVersion | MicroProfile version | 3.2 |
| slf4jVersion | Slf4j version | 1.7.30 |
| junitVersion | JUnit 4 version | 4.13 |
| testcontainersVersion | Testcontainers version | 1.13.0 |
| restAssuredVersion | Rest Assured version | 4.3.0 |
| surefirePluginVersion | Surefire plugin version | 3.0.0-M4 |
| failsafePluginVersion | Failsafe plugin version | 3.0.0-M4 |
Currently MicroProfile 3.3 is not yet supported since Open Liberty does not yet provide the MicroProfile-3.3 feature.
To create a project based on the archetype:
$ mvn archetype:generate -DarchetypeCatalog=local \
-DarchetypeGroupId=de.cwansart.archetypes \
-DarchetypeArtifactId=jakartaeeAfter creating you can run tests and run the application via Maven:
$ mvn clean verify
$ mvn liberty:runInstead of using the long and hard to remember generate command you can add a function to your .bash_profile:
gen-jakarta () {
mvn archetype:generate -DarchetypeCatalog=local \
-DarchetypeGroupId=de.cwansart.archetypes \
-DarchetypeArtifactId=jakartaee $@
}
gen-microprofile () {
mvn archetype:generate -DarchetypeCatalog=local \
-DarchetypeGroupId=de.cwansart.archetypes \
-DarchetypeArtifactId=microprofile $@
}After adding and reloading the terminal session you can run the command via:
$ gen-jakartaYou can also pass additional parameters like the ones listed above:
$ gen-jakarta -DopenLibertyVersion=20.0.0.3