Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rieckpil/custom-maven-archetypes

:open_file_folder: Maven Archetypes to conveniently bootstrap new Java projects
https://github.com/rieckpil/custom-maven-archetypes

jakarta-ee java java-ee jsf jsf-development maven maven-archetype openliberty payara project-template tomee wildfly

Last synced: 2 months ago
JSON representation

:open_file_folder: Maven Archetypes to conveniently bootstrap new Java projects

Awesome Lists containing this project

README

        

# Bootstrap New Maven Projects With Ease

[![Jakarta EE Archetype Maven Central](https://img.shields.io/maven-central/v/de.rieckpil.archetypes/jakartaee8.svg?label=Jakarta%20EE%20Archetype%20Maven%20Central)](https://search.maven.org/search?q=g:%22de.rieckpil.archetypes%22%20AND%20a:%22jakartaee8%22)
[![JSF Archetype Maven Central](https://img.shields.io/maven-central/v/de.rieckpil.archetypes/javaee8-jsf.svg?label=JSF%20Archetype%20Maven%20Central)](https://search.maven.org/search?q=g:%22de.rieckpil.archetypes%22%20AND%20a:%22javaee8-jsf%22)
[![Java EE Archetype Maven Central](https://img.shields.io/maven-central/v/de.rieckpil.archetypes/javaee8.svg?label=Java%20EE%20Archetype%20Maven%20Central)](https://search.maven.org/search?q=g:%22de.rieckpil.archetypes%22%20AND%20a:%22javaee8%22)
[![Testing Toolkit Archetype Maven Central](https://img.shields.io/maven-central/v/de.rieckpil.archetypes/testing-toolkit.svg?label=Testing%20Toolkit%20Archetype%20Maven%20Central)](https://search.maven.org/search?q=g:%22de.rieckpil.archetypes%22%20AND%20a:%22testing-toolkit%22)

[![Build Maven Archetypes](https://github.com/rieckpil/custom-maven-archetypes/workflows/Build%20Maven%20Archetypes/badge.svg)](https://github.com/rieckpil/custom-maven-archetypes/actions)

[Maven Archetypes](https://maven.apache.org/guides/introduction/introduction-to-archetypes.html) are a project templating toolkit to scaffold new Maven projects in seconds.

This repository contains a set of custom Maven Archetypes to conveniently bootstrap your next Java project:

* [Java Project with Basic Testing Capabilities](#java-project-with-basic-testing-capabilities)
* [Jakarta EE 8 with Microprofile 3.3 and Java 11](#jakarta-ee-8-with-microprofile-33-and-java-11)
* [Java EE 8 with Microprofile 3.3 and Java 11 for JSF development](#java-ee-8-with-microprofile-33-and-java-11-for-jsf-development)
* [Java EE 8 with Microprofile 3.3 and Java 11](#java-ee-8-with-microprofile-33-and-java-11)

## Archetype Usage

Prerequisites:

* Java 8 or 17 (for `testing-toolkit` archetype)
* Maven (either as a CLI tool or using the Maven Wrapper) > 3.6.1

Bootstrap a new Maven project using an archetype on Mac and Linux:

```shell
mvn archetype:generate \
-DarchetypeGroupId=de.rieckpil.archetypes \
-DarchetypeArtifactId= \
-DarchetypeVersion= \
-DgroupId= \
-DartifactId= \
-DinteractiveMode=false
```

Bootstrap a new Maven project using an archetype on Windows (CMD or PowerShell):

```shell
mvn archetype:generate "-DarchetypeGroupId=de.rieckpil.archetypes" "-DarchetypeArtifactId=" "-DarchetypeVersion=" "-DgroupId=" "-DartifactId=" "-DinteractiveMode=false"
```

Make sure to replace all `` placeholders before running the commands on your machine.

The available archetype names are:

- `testing-toolkit`
- `jakartaee8`
- `javaee8`
- `javaee8-jsf`

You can find the latest version of each archetype as part of the badges on top of this README. The badges display the version with a preceding `v`, e.g. `v1.0.2` which you must remove.

Complete example for Mac or Linux:

```shell
mvn archetype:generate \
-DarchetypeGroupId=de.rieckpil.archetypes \
-DarchetypeArtifactId=testing-toolkit \
-DarchetypeVersion=1.0.2 \
-DgroupId=com.mycompany \
-DartifactId=order-service \
-DinteractiveMode=false
```

```shell
cd order-service
./mvnw package
```

Complete example for Windows:

```shell
mvn archetype:generate "-DarchetypeGroupId=de.rieckpil.archetypes" "-DarchetypeArtifactId=testing-toolkit" "-DarchetypeVersion=1.0.2" "-DgroupId=com.mycompany" "-DartifactId=order-service" "-DinteractiveMode=false"
```
```shell
cd order-service
mvnw package
```

## Java Project with Basic Testing Capabilities

**Archetype name**: `testing-toolkit`

With this Maven archetype you can bootstrap a simple Java 17 application with basic testing capabilities in seconds. This archetype contains the following files/dependencies:

* Java 17
* Mockito and JUnit 5 dependencies for efficient testing
* Testcontainers for integration test
* AssertJ for writing fluent assertions
* A basic JUnit Jupiter test
* Maven Wrapper
* A basic `.gitignore`

Refer to the [Maven Setup For Testing Java Applications](https://rieckpil.de/maven-setup-for-testing-java-applications/) blog post on how to get started with this project.

## Jakarta EE 8 with Microprofile 3.3 and Java 11

**Archetype name**: `jakartaee8`

With this Maven archetype you can bootstrap a simple Jakarta EE 8 application in seconds. This archetype contains the following files/dependencies:

* Jakarta EE 8 API dependency
* Microprofile 3.3 dependency
* Mockito and JUnit 5 dependencies for efficient testing
* `beans.xml` with `bean-discovery-mode="all"`
* `persistence.xml` configured for JTA persistence unit
* `microprofile-config.properties` for configuration
* Dockerfile for latest Open Liberty deployment
* Build and deploy script as `.sh` and `.bat`

Bootstrapping and deploying a new application under **Linux/Mac** (Docker daemon needs to run):

```
mvn archetype:generate -DarchetypeGroupId=de.rieckpil.archetypes -DarchetypeArtifactId=jakartaee8 -DarchetypeVersion=1.1.0 -DgroupId=de.rieckpil.blog -DartifactId=jakartaee-8-microservice -DinteractiveMode=false
cd jakartaee-8-microservice
./buildAndRun.sh
```

After Open Liberty successfully started visit `http://localhost:9080/resources/sample`

## Java EE 8 with Microprofile 3.3 and Java 11

**Archetype name**: `javaee8`

With this Maven archetype you can bootstrap a simple Java EE 8 application in seconds. This archetype contains the following files/dependencies:

* Java EE 8 API dependency
* Microprofile 3.3 dependency
* Mockito and JUnit 5 dependencies for efficient testing
* `beans.xml` with `bean-discovery-mode="all"`
* `persistence.xml` configured for JTA persistence unit
* `microprofile-config.properties` for configuration
* Dockerfile for latest Open Liberty deployment
* Build and deploy script as `.sh` and `.bat`

Bootstrapping and deploying a new application under **Linux/Mac** (Docker daemon needs to run):

```
mvn archetype:generate -DarchetypeGroupId=de.rieckpil.archetypes -DarchetypeArtifactId=javaee8 -DarchetypeVersion=2.1.0 -DgroupId=de.rieckpil.blog -DartifactId=javaee-8-microservice -DinteractiveMode=false
cd javaee-8-microservice
./buildAndRun.sh
```

After Open Liberty successfully started visit `http://localhost:9080/resources/sample`

## Java EE 8 with Microprofile 3.3 and Java 11 for JSF development

**Archetype name**: `javaee8-jsf`

With this Maven archetype you can bootstrap a simple Java EE 8 JSF application in seconds. This archetype contains the following files/dependencies:

* Java EE 8 API dependency
* Microprofile 3.3 dependency
* Primefaces 8.0 and all-themes dependency
* Omnifaces 3.6.1 dependency
* Mockito and JUnit 5 dependencies for efficient testing
* `web.xml` for JSF development with `bootstrap` as selected PrimeFaces theme
* `beans.xml` with `bean-discovery-mode="all"`
* `persistence.xml` configured for JTA persistence unit
* `microprofile-config.properties` for configuration
* Simple `index.xhtml` with backing bean `SampleBean`
* Dockerfile for latest Open Liberty deployment
* Build and deploy script as `.sh` and `.bat`

Bootstrapping and deploying a new application under **Linux/Mac** (Docker daemon needs to run):

```
mvn archetype:generate -DarchetypeGroupId=de.rieckpil.archetypes -DarchetypeArtifactId=javaee8-jsf -DarchetypeVersion=2.1.0 -DgroupId=de.rieckpil.blog -DartifactId=jsf-app -DinteractiveMode=false
cd jsf-app
chmod +x buildAndRun.sh
./buildAndRun.sh
```

After Open Liberty successfully started visit `http://localhost:9080/`