Usage
Generate a Project
mvn archetype:generate \
-DarchetypeGroupId=io.github.jeffjensen \
-DarchetypeArtifactId=java-service-archetype \
-DarchetypeVersion=1.0.0Maven first prompts for 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) |
It then prompts for the three archetype-specific properties below.
The generated project is created in ./{artifactId}/ relative to the current directory.
integrations
Comma-separated type:name pairs, one per external data source or system.
database:users,rest:orders,graphql:catalogSupported types include database, rest, graphql, file, email, jms, kafka,
and any other label you choose.
- The
databasetype is abbreviated todbin 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,notificationsEach 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,graphqlSupported 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.
Examples
Minimal project
| Property | Value |
|---|---|
integrations |
(blank) |
serviceAreas |
(blank) |
presentationTypes |
(blank) |
Produces: acceptance-tests, app, common-domain, common-testing, service.
Typical single-service REST API backed by a database
| Property | Value |
|---|---|
integrations |
database:users |
serviceAreas |
(blank) |
presentationTypes |
rest |
Produces: acceptance-tests, app, common-domain, common-testing,
domain-db-users, domain-rest, integration-db-users, presentation-rest, service.
Full multi-service project
| Property | Value |
|---|---|
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,
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=1.0.0 \
-DgroupId=com.example \
-DartifactId=my-service \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=com.example.myservice \
-Dintegrations=database:users,rest:orders,graphql:catalog \
-DserviceAreas=orders,inventory \
-DpresentationTypes=rest,graphql