Usage

Generate a Project

mvn archetype:generate \
  -DarchetypeGroupId=io.github.jeffjensen \
  -DarchetypeArtifactId=java-service-archetype \
  -DarchetypeVersion=VERSION

Replace VERSION with the archetype release you want to use.

Maven prompts for appName and integrations first — the two archetype-specific properties with no default — then the standard Maven coordinates:

Prompt Description
groupId Maven group ID (e.g. com.example)
artifactId Maven artifact ID and root directory name (e.g. my-service)
version Initial version (default: 1.0.0-SNAPSHOT)
package Base Java package (e.g. com.example.myservice)

serviceAreas, presentationTypes, and includeSpring also have defaults, so none of them are prompted interactively; override any of them with a -D flag, as shown in the full command line example below.

All five archetype-specific properties are documented below, in prompt / declaration order: appName, integrations, serviceAreas, presentationTypes, includeSpring. The generated project is created in ./{artifactId}/ relative to the current directory.

appName

Brief, human-readable application name: capitalized words separated by spaces.

Order Service

appName drives generated content in three ways:

  • Class names remove the spaces, e.g. OrderService.
  • Generated property values remove the spaces and lowercase everything, e.g. orderservice (used for spring.application.name).
  • Prose (POM <name>/<description>, Javadoc) uses it unmodified, e.g. "Order Service".

No default — every project needs its own name.

integrations

Comma-separated type:name pairs, one per external data source or system.

database:users,rest:orders,graphql:catalog

Supported types include database, rest, graphql, file, email, jms, kafka, and any other label you choose.

  • The database type is abbreviated to db in all generated module and package names.
  • All type and name values are normalized to lowercase regardless of the case supplied.
  • Malformed entries (missing colon, blank type, or blank name) are silently skipped.
  • Leave blank to generate a project with no integration modules.

Each type:name pair produces a domain-{type}-{name} module and an integration-{type}-{name} module.

serviceAreas (default: empty)

Leave blank to generate a single module named service. Enter comma-separated names to generate named service areas instead.

orders,inventory,notifications

Each non-blank name produces a service-{name} module. If no non-blank names are provided, the archetype falls back to a single module named service.

presentationTypes (default: rest)

Comma-separated API / presentation-tier types.

rest,graphql

Supported types include rest, graphql, soap, grpc, and any other label you choose.

  • All type values are normalized to lowercase regardless of the case supplied.
  • Leave blank to generate a project with no presentation modules.

Each type produces a domain-{type} module and a presentation-{type} module.

includeSpring (default: true)

Whether to generate the Spring Boot wiring.

true
  • true (default): every app-composed module gets a @Configuration class plus the Spring Boot starter suited to its role, the parent inherits spring-boot-starter-parent, and app gets the Application class — always a monitorable web service (core starter, webmvc, actuator, Spring Boot Admin client, AppServletInitializer) regardless of presentationTypes — plus spring-boot-starter-data-jpa and @EnableTransactionManagement when a database integration is present.
  • false: omit all Spring artifacts (configs, classes, and pom items).

Not prompted interactively (non-empty default); override with -DincludeSpring=false on the command line to omit Spring entirely.

Examples

Minimal project

Property Value
appName My Service
integrations (blank)
serviceAreas (blank)
presentationTypes (blank)

Produces: acceptance-tests, app, common-domain, common-testing, domain-service, service.

Typical single-service REST API backed by a database

Property Value
appName My Service
integrations database:users
serviceAreas (blank)
presentationTypes rest

Produces: acceptance-tests, app, common-domain, common-testing, domain-db-users, domain-rest, domain-service, integration-db-users, presentation-rest, service.

Full multi-service project

Property Value
appName My Service
integrations database:users,rest:orders,graphql:catalog
serviceAreas orders,inventory
presentationTypes rest,graphql

Produces: acceptance-tests, app, common-domain, common-testing, domain-db-users, domain-graphql, domain-graphql-catalog, domain-rest, domain-rest-orders, domain-service-inventory, domain-service-orders, integration-db-users, integration-graphql-catalog, integration-rest-orders, presentation-graphql, presentation-rest, service-inventory, service-orders.

Full command line (non-interactive)

All properties specified as -D flags with -B (batch mode) to skip interactive prompts. Uses the same values as the full multi-service example above.

mvn archetype:generate -B \
  -DarchetypeGroupId=io.github.jeffjensen \
  -DarchetypeArtifactId=java-service-archetype \
  -DarchetypeVersion=VERSION \
  -DgroupId=com.example \
  -DartifactId=my-service \
  -Dversion=1.0.0-SNAPSHOT \
  -Dpackage=com.example.myservice \
  -DappName="My Service" \
  -Dintegrations=database:users,rest:orders,graphql:catalog \
  -DserviceAreas=orders,inventory \
  -DpresentationTypes=rest,graphql