This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-archetype.git
The following commit(s) were added to refs/heads/master by this push:
new bfbf0501 Replace the outdated console transcripts with current ones
bfbf0501 is described below
commit bfbf05016b4539e1060a3daa62613ae8b332eb5d
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Sat Oct 31 17:48:49 2026 +0000
Replace the outdated console transcripts with current ones
---
.../src/site/markdown/advanced-usage.md | 105 ++--
.../examples/create-multi-module-project.md | 635 ++++-----------------
.../markdown/examples/create-with-property-file.md | 233 +++-----
.../src/site/markdown/examples/generate-batch.md | 30 +-
maven-archetype-plugin/src/site/markdown/usage.md | 153 ++---
5 files changed, 262 insertions(+), 894 deletions(-)
diff --git a/maven-archetype-plugin/src/site/markdown/advanced-usage.md
b/maven-archetype-plugin/src/site/markdown/advanced-usage.md
index ea5a6640..b7936c6c 100644
--- a/maven-archetype-plugin/src/site/markdown/advanced-usage.md
+++ b/maven-archetype-plugin/src/site/markdown/advanced-usage.md
@@ -31,42 +31,22 @@ Creating an archetype from an existing project involves
three steps:
- the archetype resolution
- the archetype installation:deployment
- the archetype usage
-# Usage
+
+## Usage
Calling `mvn archetype:create-from-project` the plugin first resolves the
package by guessing the project directory.
It then generates the directory tree of the archetype in the
`target/generated-sources/archetype` directory.
```shell
-mvn archetype:create-from-project
-[INFO] Scanning for projects...
-[INFO] Searching repository for plugin with prefix: 'archetype'.
-[INFO] ------------------------------------------------------------------------
-[INFO] Building project
-[INFO] task-segment: [archetype:create-from-project]
-[INFO] ------------------------------------------------------------------------
-[INFO] Preparing archetype:create-from-project
-[INFO] No goals needed for project - skipping
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:create-from-project]
-[INFO] Setting default archetype's groupId: com.company
-[INFO] Setting default archetype's artifactId: project
-[INFO] Setting default archetype's version: 1.0-SNAPSHOT
+$ mvn archetype:create-from-project
+[INFO] --- archetype:3.4.1:create-from-project (default-cli) @ project ---
[INFO] Setting default groupId: com.company
[INFO] Setting default artifactId: project
-[INFO] Setting default version: 1.0-SNAPSHOT
+[INFO] Setting default version: 1.0
[INFO] Setting default package: com.company.project
-[INFO] Archetype created in target/generated-sources/archetype
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 4 seconds
-[INFO] Finished at: Fri Feb 22 21:49:52 GMT 2008
-[INFO] Final Memory: 10M/26M
-[INFO] ------------------------------------------------------------------------
+[INFO] Archetype project created in
/home/user/projects/project/target/generated-sources/archetype
+[INFO] BUILD SUCCESS
```
Then move to that generated directory and call `mvn install` on the created
archetype.
@@ -74,32 +54,15 @@ Then move to that generated directory and call `mvn
install` on the created arch
```shell
$ cd target/generated-sources/archetype/
$ mvn install
-[INFO] Scanning for projects...
-[INFO] ------------------------------------------------------------------------
-[INFO] Building project
-[INFO] task-segment: [install]
-[INFO] ------------------------------------------------------------------------
-[INFO] [resources:resources]
-[INFO] Using default encoding to copy filtered resources.
-[INFO] [resources:testResources]
-[INFO] Using default encoding to copy filtered resources.
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:jar]
-[INFO] [archetype:add-archetype-metadata]
-[INFO] [archetype:integration-test]
-[INFO] [install:install]
-[INFO] Installing
/home/local/rafale/projects/tmp/project/target/generated-sources/archetype/target/project-1.0-SNAPSHOT.jar
to
/home/rafale/.m2/repository/com/company/project/1.0-SNAPSHOT/project-1.0-SNAPSHOT.jar
-[INFO] [archetype:update-local-catalog]
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 10 seconds
-[INFO] Finished at: Fri Feb 22 21:51:57 GMT 2008
-[INFO] Final Memory: 14M/35M
-[INFO] ------------------------------------------------------------------------
+[INFO] --- archetype:3.4.1:jar (default-jar) @ project-archetype ---
+[INFO] Building archetype jar:
/home/user/projects/project/target/generated-sources/archetype/target/project-archetype-1.0.jar
+[INFO] --- archetype:3.4.1:integration-test (default-integration-test) @
project-archetype ---
+[INFO] Processing Archetype IT project: basic
+[INFO] --- install:3.1.4:install (default-install) @ project-archetype ---
+[INFO] Installing
/home/user/projects/project/target/generated-sources/archetype/target/project-archetype-1.0.jar
to
/home/user/.m2/repository/com/company/project-archetype/1.0/project-archetype-1.0.jar
+[INFO] --- archetype:3.4.1:update-local-catalog (default-update-local-catalog)
@ project-archetype ---
+[INFO] Updated local archetypes catalog
/home/user/.m2/repository/archetype-catalog.xml
+[INFO] BUILD SUCCESS
```
Finally move to a fresh directory and use your archetype.
@@ -108,29 +71,29 @@ Finally move to a fresh directory and use your archetype.
$ mkdir /tmp/archetype
$ cd /tmp/archetype
$ mvn archetype:generate -DarchetypeCatalog=local
-[INFO] Scanning for projects...
-[INFO] Searching repository for plugin with prefix: 'archetype'.
-[INFO] ------------------------------------------------------------------------
-[INFO] Building Maven Default Project
-[INFO] task-segment: [archetype:generate] (aggregator-style)
-[INFO] ------------------------------------------------------------------------
-[INFO] Preparing archetype:generate
-[INFO] No goals needed for project - skipping
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:generate]
Choose archetype:
-1: local -> project (project)
-Choose a number or apply filter (format: [groupId:]artifactId, case sensitive
contains): 1:
+1: local -> com.company:project-archetype (project-archetype)
+Choose a number or apply filter (format: [groupId:]artifactId, case sensitive
contains): 1: 1
+Define value for property 'groupId': org.example
+Define value for property 'artifactId': my-app
+Define value for property 'version' 1.0-SNAPSHOT: 1.0-SNAPSHOT
+Define value for property 'package' org.example: org.example
+Confirm properties configuration:
+groupId: org.example
+artifactId: my-app
+version: 1.0-SNAPSHOT
+package: org.example
+ Y:
+[INFO] Using following parameters for creating project from Archetype:
project-archetype:1.0
+[INFO] Project created from Archetype in dir: /tmp/archetype/my-app
+[INFO] BUILD SUCCESS
```
-# Testing
+## Testing
The user can provide archetype test projects by placing them in
`src/it/projects` folder of their project. Upon creating archetype from the
existing project all the test projects will be executed to verify the archetype
created by this project is good. [Read more](./integration-test-mojo.html)
about testing maven archetype.
-# Configuration
+## Configuration
The `create-from-project` goal enable the user to provide some sensible
configuration using the system properties or a property file.
@@ -138,6 +101,6 @@ The system properties permits the user to define the
groupId, artifactId, versio
When used, the property file takes precedence over the system properties. It
is also the only way to define additional properties in the archetype.
-# Post-generation script
+## Post-generation script
If the user wants to customize the generated project even further, a groovy
script named `archetype-post-generate.groovy` can be added in
`src/main/resources/META-INF/`. This script will end up in the generated
archetype's `META-INF` folder and will be executed upon creating a project from
this archetype. This groovy script has access to the
`ArchetypeGenerationRequest` object, as well as all the
`System.getProperties()` and all the archetype generation properties the user
has specified.
diff --git
a/maven-archetype-plugin/src/site/markdown/examples/create-multi-module-project.md
b/maven-archetype-plugin/src/site/markdown/examples/create-multi-module-project.md
index d2d2a20e..724583d6 100644
---
a/maven-archetype-plugin/src/site/markdown/examples/create-multi-module-project.md
+++
b/maven-archetype-plugin/src/site/markdown/examples/create-multi-module-project.md
@@ -30,561 +30,118 @@ Creating an archetype for a multi-module project is as
simple as [creating one f
Just move to the root directory of a multi-module project and call `mvn
archetype:create-from-project`. In the archetype used as an example, some files
need to be non filtered. This is achieved by giving the archetype plugin some
values in the `archetype.filteredExtensions` property.
+The example project has a parent `com.company:multi` and two modules,
`multi-core` and `multi-app`:
+
+```text
+.
+├── multi-app
+│ ├── pom.xml
+│ └── src
+│ └── main
+│ └── java
+│ └── com
+│ └── company
+│ └── project
+│ └── AppService.java
+├── multi-core
+│ ├── pom.xml
+│ └── src
+│ └── main
+│ └── java
+│ └── com
+│ └── company
+│ └── project
+│ └── CoreService.java
+└── pom.xml
+```
+
```shell
$ mvn archetype:create-from-project -Darchetype.filteredExtensions=java
-[INFO] Scanning for projects...
-[INFO] Reactor build order:
-[INFO] archetype
-[INFO] archetype :: business domain model
-[INFO] archetype :: business services
-[INFO] archetype :: persistence layer
-[INFO] archetype :: infrastructure
-[INFO] archetype :: remoting
-[INFO] archetype :: web services
-[INFO] archetype :: web application
-[INFO] archetype :: enterprise application
-[INFO] Searching repository for plugin with prefix: 'archetype'.
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype
-[INFO] task-segment: [archetype:create-from-project] (aggregator-style)
-[INFO] ------------------------------------------------------------------------
-[INFO] Preparing archetype:create-from-project
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: business domain model
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: business services
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: persistence layer
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: infrastructure
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: remoting
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: web services
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: web application
-[INFO] ------------------------------------------------------------------------
-[INFO] [gwt:eclipse {execution: default}]
-[INFO] Unpack native libraries required to run hosted browser
-[INFO] [gwt:generateAsync {execution: default}]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype :: enterprise application
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:create-from-project]
-[INFO] Setting default groupId: com.capgemini.archetype
-[INFO] Setting default artifactId: archetype
-[INFO] Setting default version: 1.0.0-SNAPSHOT
-[INFO] Setting default package: com.capgemini
-[INFO] Archetype created in target/generated-sources/archetype
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 7 seconds
-[INFO] Finished at: Mon Sep 15 19:11:17 CEST 2008
-[INFO] Final Memory: 19M/36M
-[INFO] ------------------------------------------------------------------------
+[INFO] Reactor Build Order:
+[INFO] multi [pom]
+[INFO] multi-core [jar]
+[INFO] multi-app [jar]
+[INFO] --- archetype:3.4.1:create-from-project (default-cli) @ multi ---
+[INFO] Setting default groupId: com.company
+[INFO] Setting default artifactId: multi
+[INFO] Setting default version: 1.0-SNAPSHOT
+[INFO] Setting default package: com.company.project
+[INFO] Archetype project created in
/home/user/projects/multi/target/generated-sources/archetype
+[INFO] Reactor Summary for multi 1.0-SNAPSHOT:
+[INFO] multi .............................................. SUCCESS
+[INFO] multi-core ......................................... SKIPPED
+[INFO] multi-app .......................................... SKIPPED
+[INFO] BUILD SUCCESS
```
-Install the archetype as usual.
+The goal runs only in the root project, as the Reactor Summary shows. Install
the archetype as usual.
```shell
$ cd target/generated-sources/archetype/
$ mvn install
-[INFO] Scanning for projects...
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype-archetype
-[INFO] task-segment: [install]
-[INFO] ------------------------------------------------------------------------
-[INFO] [resources:resources]
-[INFO] Using default encoding to copy filtered resources.
-[INFO] [resources:testResources]
-[INFO] Using default encoding to copy filtered resources.
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:jar]
-[INFO] [archetype:add-archetype-metadata]
-[INFO] [archetype:integration-test]
-[INFO] [install:install]
-[INFO] Installing
/Users/raphaelpieroni/Projects/platina/platina-archetype/target/generated-sources/archetype/target/archetype-archetype-1.0.0-SNAPSHOT.jar
to
/Users/raphaelpieroni/.m2/repository/com/capgemini/archetype/archetype-archetype/1.0.0-SNAPSHOT/archetype-archetype-1.0.0-SNAPSHOT.jar
-[INFO] [archetype:update-local-catalog]
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 4 seconds
-[INFO] Finished at: Mon Sep 15 19:11:54 CEST 2008
-[INFO] Final Memory: 10M/20M
-[INFO] ------------------------------------------------------------------------
+[INFO] --- archetype:3.4.1:jar (default-jar) @ multi-archetype ---
+[INFO] --- archetype:3.4.1:integration-test (default-integration-test) @
multi-archetype ---
+[INFO] Processing Archetype IT project: basic
+[INFO] --- install:3.1.4:install (default-install) @ multi-archetype ---
+[INFO] --- archetype:3.4.1:update-local-catalog (default-update-local-catalog)
@ multi-archetype ---
+[INFO] BUILD SUCCESS
```
-And use it.
+And use it. This example selects the archetype in batch mode from the local
catalog.
```shell
-$ cd /tmp/archetype/
-$ mvn archetype:generate -DarchetypeCatalog=local
-[INFO] Scanning for projects...
-[INFO] Searching repository for plugin with prefix: 'archetype'.
-[INFO] ------------------------------------------------------------------------
-[INFO] Building Maven Default Project
-[INFO] task-segment: [archetype:generate] (aggregator-style)
-[INFO] ------------------------------------------------------------------------
-[INFO] Preparing archetype:generate
-[INFO] No goals needed for project - skipping
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:generate]
-[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: local -> archetype (archetype)
-2: local -> archetype-archetype (archetype-archetype)
-Choose a number or apply filter (format: [groupId:]artifactId, case sensitive
contains): 2
-Define value for groupId: : com.company
-Define value for artifactId: : project
-Define value for version: 1.0-SNAPSHOT: :
-Define value for package: com.company: :
-Confirm properties configuration:
-groupId: com.company
-artifactId: project
-version: 1.0-SNAPSHOT
-package: com.company
- Y: :
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/pom.xml [line 22,column 9] :
${project.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-business/pom.xml [line
18,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-business/pom.xml [line
30,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
18,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
35,column 20] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
51,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
57,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
97,column 26] : ${project.build.directory} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
98,column 29] : ${project.build.outputDirectory} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
101,column 29] : ${project.build.directory} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-domain/pom.xml [line
128,column 33] : ${project.build.directory} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-persistence/pom.xml [line
18,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-persistence/pom.xml [line
30,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-persistence/pom.xml [line
35,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-persistence/pom.xml [line
40,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-persistence/pom.xml [line
57,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-infrastructure/pom.xml
[line 18,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-infrastructure/pom.xml
[line 29,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-infrastructure/pom.xml
[line 45,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-infrastructure/pom.xml
[line 50,column 16] : ${aspectj.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-infrastructure/pom.xml
[line 55,column 16] : ${aspectj.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-remoting/pom.xml [line
18,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-remoting/pom.xml [line
31,column 20] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-remoting/pom.xml [line
40,column 20] : ${cxf.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-remoting/pom.xml [line
45,column 20] : ${cxf.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
19,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
27,column 18] : ${project.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
37,column 16] : ${project.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
70,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
104,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
109,column 16] : ${struts.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
114,column 16] : ${struts.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
126,column 16] : ${gwt.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
132,column 16] : ${gwt.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
139,column 16] : ${gwt.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
147,column 16] : ${gwt.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
175,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
181,column 16] : ${webflow.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
213,column 16] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webapp/pom.xml [line
238,column 28] : ${basedir} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webservices/pom.xml [line
18,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webservices/pom.xml [line
30,column 26] : ${cxf.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webservices/pom.xml [line
44,column 20] : ${cxf.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webservices/pom.xml [line
49,column 20] : ${cxf.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webservices/pom.xml [line
54,column 20] : ${cxf.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-webservices/pom.xml [line
60,column 20] : ${spring.version} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-application/pom.xml [line
19,column 9] : ${project.parent.artifactId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-application/pom.xml [line
27,column 24] : ${project.groupId} is not a valid reference.
-[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference
: template = archetype-resources/__rootArtifactId__-application/pom.xml [line
39,column 16] : ${project.groupId} is not a valid reference.
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 33 seconds
-[INFO] Finished at: Mon Sep 15 19:13:54 CEST 2008
-[INFO] Final Memory: 8M/15M
-[INFO] ------------------------------------------------------------------------
+$ cd /home/user/projects/
+$ mvn archetype:generate -B -DarchetypeCatalog=local
-DarchetypeGroupId=com.company -DarchetypeArtifactId=multi-archetype
-DarchetypeVersion=1.0-SNAPSHOT -DgroupId=org.example -DartifactId=demo
-Dversion=1.0-SNAPSHOT
+[INFO] Generating project in Batch mode
+[INFO] Archetype repository not defined. Using the one from
[com.company:multi-archetype:1.0-SNAPSHOT] found in catalog local
+[INFO] Parameter: groupId, Value: org.example
+[INFO] Parameter: artifactId, Value: demo
+[INFO] Parameter: version, Value: 1.0-SNAPSHOT
+[INFO] Parameter: package, Value: org.example
+[INFO] Project created from Archetype in dir: /home/user/projects/demo
+[INFO] BUILD SUCCESS
```
-As one can see, Velocity, the internal processor of archetype files, complains
about not finding some properties. One should not worry about that. What is
more interesting, is that the archetype plugin has renamed the original project
module to "\__rootArtifactId\_\_". And during the generation that name is
converted to the provided artifactId.
+As one can see in the tree of the archetype, the archetype plugin has renamed
the original project modules to "\__rootArtifactId\_\_-core" and
"\__rootArtifactId\_\_-app". And during the generation that name is converted
to the provided artifactId.
+
+```text
+archetype-resources
+├── __rootArtifactId__-app
+│ ├── pom.xml
+│ └── src
+│ └── main
+│ └── java
+│ └── AppService.java
+├── __rootArtifactId__-core
+│ ├── pom.xml
+│ └── src
+│ └── main
+│ └── java
+│ └── CoreService.java
+└── pom.xml
+```
The resulting directory tree of the project is shown here.
-```shell
-$ tree
-.
-|____project
-| |____pom.xml
-| |____project-application
-| | |____pom.xml
-| |____project-business
-| | |____pom.xml
-| | |____src
-| | | |____main
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____services
-| | | | | | | | | |____BusinessService.java
-| | | | |____resources
-| | | | | |____META-INF
-| | | | | | |____spring
-| | | | | | | |____module-context.xml
-| | | |____test
-| | | | |____resources
-| | | | | |____log4j.xml
-| |____project-domain
-| | |____pom.xml
-| | |____src
-| | | |____main
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____domain
-| | | | | | | | | |____ConfigurableBean.java
-| | | | | | | | | |____User.java
-| | | | |____resources
-| | | | | |____META-INF
-| | | | | | |____orm.xml
-| | | |____test
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____domain
-| | | | | | | | | |____AbstractConfigurableBeanTest.java
-| | | | |____resources
-| | | | | |____log4j.xml
-| |____project-infrastructure
-| | |____pom.xml
-| | |____src
-| | | |____main
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____infrastructure
-| | | | | | | | | |____CompositeConfigurationFactoryBean.java
-| | | | | | | | | |____DefaultSecurityPolicy.java
-| | | | | | | | | |____Log4jMBean.java
-| | | | | | | | | |____SpringBeanConfigurer.java
-| | | | | | | | | |____SystemArchitecture.java
-| | | | |____resources
-| | | | | |____archetype.properties
-| | | | | |____META-INF
-| | | | | | |____aop.xml
-| | | | | | |____spring
-| | | | | | | |____module-context.xml
-| | | |____test
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____quickstart
-| | | | | | | | |____SanityTest.java
-| | | | |____resources
-| | | | | |____log4j.xml
-| |____project-persistence
-| | |____pom.xml
-| | |____src
-| | | |____main
-| | | | |____resources
-| | | | | |____META-INF
-| | | | | | |____persistence.xml
-| | | | | | |____spring
-| | | | | | | |____module-context.xml
-| | | |____test
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____persistence
-| | | | | | | | | |____JpaClientRepositoryTest.java
-| | | | | | | | | |____MappingsTest.java
-| | | | |____resources
-| | | | | |____jdbc-tests.xml
-| | | | | |____log4j.xml
-| | | | | |____unitils.properties
-| |____project-remoting
-| | |____pom.xml
-| | |____src
-| | | |____main
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____remoting
-| | | | | | | | | |____Connector.java
-| | | | |____resources
-| | | | | |____META-INF
-| | | | | | |____spring
-| | | | | | | |____module-context.xml
-| | | |____test
-| | | | |____resources
-| | | | | |____log4j.xml
-| |____project-webapp
-| | |____com.capgemini.archetype.gwt.Application.launch
-| | |____pom.xml
-| | |____src
-| | | |____main
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____web
-| | | | | | | | | |____struts
-| | | | | | | | | | |____AbstractPostBackAction.java
-| | | | | | | | | | |____GlobalExceptionHandler.java
-| | | | | | | | | | |____SafeActionMapping.java
-| | | | |____resources
-| | | | | |____META-INF
-| | | | | | |____log4j.xml
-| | | | | | |____spring
-| | | | | | | |____module-context.xml
-| | | | |____webapp
-| | | | | |____error.jsp
-| | | | | |____index.html
-| | | | | |____notFound.jsp
-| | | | | |____WEB-INF
-| | | | | | |____jonas-web.xml
-| | | | | | |____spring-web-context.xml
-| | | | | | |____struts-config.xml
-| | | | | | |____web.xml
-| | | | | | |____weblogic.xml
-| | | |____test
-| | | | |____resources
-| | | | | |____log4j.xml
-| | | | |____tomcat
-| | | | | |____context.xml
-| |____project-webservices
-| | |____pom.xml
-| | |____src
-| | | |____main
-| | | | |____resources
-| | | | | |____META-INF
-| | | | | | |____spring
-| | | | | | | |____module-context.xml
-| | | |____test
-| | | | |____java
-| | | | | |____com
-| | | | | | |____company
-| | | | | | | |____archetype
-| | | | | | | | |____ws
-| | | | | | | | | |____AbstractWSTestCase.java
-| | | | |____resources
-| | | | | |____log4j.xml
+```text
+demo
+├── demo-app
+│ ├── pom.xml
+│ └── src
+│ └── main
+│ └── java
+│ └── org
+│ └── example
+│ └── AppService.java
+├── demo-core
+│ ├── pom.xml
+│ └── src
+│ └── main
+│ └── java
+│ └── org
+│ └── example
+│ └── CoreService.java
+└── pom.xml
```
-This can be compared to the original tree of the project from which the
archetype is originating.
-
-```shell
-$ tree
-.
-|____archetype-application
-| |____pom.xml
-|____archetype-business
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____services
-| | | | | | | | |____BusinessService.java
-| | | |____resources
-| | | | |____META-INF
-| | | | | |____spring
-| | | | | | |____module-context.xml
-| | |____test
-| | | |____java
-| | | |____resources
-| | | | |____log4j.xml
-|____archetype-domain
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____domain
-| | | | | | | | |____ConfigurableBean.java
-| | | | | | | | |____User.java
-| | | |____resources
-| | | | |____META-INF
-| | | | | |____orm.xml
-| | |____test
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____domain
-| | | | | | | | |____AbstractConfigurableBeanTest.java
-| | | |____resources
-| | | | |____log4j.xml
-|____archetype-infrastructure
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____infrastructure
-| | | | | | | | |____CompositeConfigurationFactoryBean.java
-| | | | | | | | |____DefaultSecurityPolicy.java
-| | | | | | | | |____Log4jMBean.java
-| | | | | | | | |____SpringBeanConfigurer.java
-| | | | | | | | |____SystemArchitecture.java
-| | | |____resources
-| | | | |____archetype.properties
-| | | | |____META-INF
-| | | | | |____aop.xml
-| | | | | |____spring
-| | | | | | |____module-context.xml
-| | |____test
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____quickstart
-| | | | | | | |____SanityTest.java
-| | | |____resources
-| | | | |____log4j.xml
-|____archetype-persistence
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____ddl
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____persistence
-| | | |____resources
-| | | | |____META-INF
-| | | | | |____persistence.xml
-| | | | | |____spring
-| | | | | | |____module-context.xml
-| | |____test
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____persistence
-| | | | | | | | |____JpaClientRepositoryTest.java
-| | | | | | | | |____MappingsTest.java
-| | | |____resources
-| | | | |____jdbc-tests.xml
-| | | | |____log4j.xml
-| | | | |____unitils.properties
-|____archetype-remoting
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____remoting
-| | | | | | | | |____Connector.java
-| | | |____resources
-| | | | |____META-INF
-| | | | | |____spring
-| | | | | | |____module-context.xml
-| | |____test
-| | | |____java
-| | | |____resources
-| | | | |____log4j.xml
-|____archetype-webapp
-| |____com.capgemini.archetype.gwt.Application.launch
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____web
-| | | | | | | | |____struts
-| | | | | | | | | |____AbstractPostBackAction.java
-| | | | | | | | | |____GlobalExceptionHandler.java
-| | | | | | | | | |____SafeActionMapping.java
-| | | |____resources
-| | | | |____META-INF
-| | | | | |____log4j.xml
-| | | | | |____spring
-| | | | | | |____module-context.xml
-| | | |____webapp
-| | | | |____error.jsp
-| | | | |____images
-| | | | |____index.html
-| | | | |____notFound.jsp
-| | | | |____scripts
-| | | | |____styles
-| | | | |____WEB-INF
-| | | | | |____jonas-web.xml
-| | | | | |____spring-web-context.xml
-| | | | | |____struts-config.xml
-| | | | | |____web.xml
-| | | | | |____weblogic.xml
-| | |____test
-| | | |____java
-| | | |____resources
-| | | | |____log4j.xml
-| | | |____tomcat
-| | | | |____context.xml
-|____archetype-webservices
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____ws
-| | | |____resources
-| | | | |____META-INF
-| | | | | |____spring
-| | | | | | |____module-context.xml
-| | |____test
-| | | |____java
-| | | | |____com
-| | | | | |____capgemini
-| | | | | | |____archetype
-| | | | | | | |____ws
-| | | | | | | | |____AbstractWSTestCase.java
-| | | |____resources
-| | | | |____log4j.xml
-|____archetype.properties
-|____pom.xml
-|____src
-| |____env
-| | |____dev
-```
+This can be compared to the original tree of the project from which the
archetype is originating, shown above.
diff --git
a/maven-archetype-plugin/src/site/markdown/examples/create-with-property-file.md
b/maven-archetype-plugin/src/site/markdown/examples/create-with-property-file.md
index ea1c729e..5bae665c 100644
---
a/maven-archetype-plugin/src/site/markdown/examples/create-with-property-file.md
+++
b/maven-archetype-plugin/src/site/markdown/examples/create-with-property-file.md
@@ -30,29 +30,28 @@ Creating an archetype using a property file is possible by
defining a text file
The directory above the would be archetype project:
-```shell
-$ tree
+```text
.
-|____archetype.properties
-|____some-project
-| |____pom.xml
-| |____src
-| | |____main
-| | | |____groovy
-| | | | |____com
-| | | | | |____company
-| | | | | | |____App.groovy
-| | | |____java
-| | | | |____com
-| | | | | |____company
-| | | | | | |____App.java
-| | |____test
-| | | |____java
-| | | | |____com
-| | | | | |____company
-| | | | | | |____AppTest.java
-| | | |____resources
-| | | | |____App.properties
+├── archetype.properties
+└── some-project
+ ├── pom.xml
+ └── src
+ ├── main
+ │ ├── groovy
+ │ │ └── com
+ │ │ └── company
+ │ │ └── App.groovy
+ │ ├── java
+ │ │ └── com
+ │ │ └── company
+ │ │ └── App.java
+ │ └── resources
+ │ └── App.properties
+ └── test
+ └── java
+ └── com
+ └── company
+ └── AppTest.java
```
The content of the property file:
@@ -74,147 +73,65 @@ Creating the archetype:
```shell
$ cd some-project
$ mvn archetype:create-from-project
-Darchetype.properties=../archetype.properties
-[INFO] Scanning for projects...
-[INFO] Searching repository for plugin with prefix: 'archetype'.
-[INFO] ------------------------------------------------------------------------
-[INFO] Building some-project
-[INFO] task-segment: [archetype:create-from-project] (aggregator-style)
-[INFO] ------------------------------------------------------------------------
-[INFO] Preparing archetype:create-from-project
-[INFO] ------------------------------------------------------------------------
-[INFO] Building some-project
-[INFO] ------------------------------------------------------------------------
-[INFO] No goals needed for project - skipping
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:create-from-project]
+[INFO] --- archetype:3.4.1:create-from-project (default-cli) @ some-project ---
[INFO] Setting default groupId: com.company
[INFO] Setting default artifactId: some-project
[INFO] Setting default version: 1.0-SNAPSHOT
[INFO] Setting default package: com.company
-[INFO] Archetype created in target/generated-sources/archetype
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 2 seconds
-[INFO] Finished at: Tue Sep 16 19:42:06 CEST 2008
-[INFO] Final Memory: 8M/15M
-[INFO] ------------------------------------------------------------------------
+[INFO] Archetype project created in
/home/user/projects/some-project/target/generated-sources/archetype
+[INFO] BUILD SUCCESS
$ cd target/generated-sources/archetype/
$ mvn install
-[INFO] Scanning for projects...
-[INFO] ------------------------------------------------------------------------
-[INFO] Building archetype-with-properties
-[INFO] task-segment: [install]
-[INFO] ------------------------------------------------------------------------
-[INFO] [resources:resources]
-[INFO] Using default encoding to copy filtered resources.
-[INFO] [resources:testResources]
-[INFO] Using default encoding to copy filtered resources.
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:jar]
-[INFO] [archetype:add-archetype-metadata]
-[INFO] [archetype:integration-test]
-[INFO] [install:install]
-[INFO] Installing
/private/tmp/archetypes/some-project/target/generated-sources/archetype/target/archetype-with-properties-2.0.jar
to
/Users/raphaelpieroni/.m2/repository/my/group/id/archetype-with-properties/2.0/archetype-with-properties-2.0.jar
-[INFO] [archetype:update-local-catalog]
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 5 seconds
-[INFO] Finished at: Tue Sep 16 19:43:57 CEST 2008
-[INFO] Final Memory: 10M/20M
-[INFO] ------------------------------------------------------------------------
+[INFO] --- archetype:3.4.1:jar (default-jar) @ archetype-with-properties ---
+[INFO] --- archetype:3.4.1:integration-test (default-integration-test) @
archetype-with-properties ---
+[INFO] Processing Archetype IT project: basic
+[INFO] --- install:3.1.4:install (default-install) @ archetype-with-properties
---
+[INFO] --- archetype:3.4.1:update-local-catalog (default-update-local-catalog)
@ archetype-with-properties ---
+[INFO] BUILD SUCCESS
```
-Using that archetype:
+Using that archetype. The additional property is proposed with its default
value; this example overrides it on the command line:
```shell
-$ mvn archetype:generate -DarchetypeCatalog=local
-$ mvn archetype:generate -DarchetypeCatalog=local
-[INFO] Scanning for projects...
-[INFO] Searching repository for plugin with prefix: 'archetype'.
-[INFO] ------------------------------------------------------------------------
-[INFO] Building Maven Default Project
-[INFO] task-segment: [archetype:generate] (aggregator-style)
-[INFO] ------------------------------------------------------------------------
-[INFO] Preparing archetype:generate
-[INFO] No goals needed for project - skipping
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:generate]
-[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: local -> archetype-with-properties (archetype-with-properties)
-Choose a number or apply filter (format: [groupId:]artifactId, case sensitive
contains): 1
-Define value for groupId: : foo
-Define value for artifactId: : bar
-Define value for version: 1.0-SNAPSHOT: :
-Define value for package: foo: :
-Confirm properties configuration:
-an_additional_property: my specific value
-groupId: foo
-artifactId: bar
-version: 1.0-SNAPSHOT
-package: foo
- Y: : N
-Define value for an_additional_property: my specific value: : my new value
-Define value for groupId: : my.new.group
-Define value for artifactId: : my-new-artifact
-Define value for version: 1.0-SNAPSHOT: :
-Define value for package: my.new.group: :
-Confirm properties configuration:
-an_additional_property: my new value
-groupId: my.new.group
-artifactId: my-new-artifact
-version: 1.0-SNAPSHOT
-package: my.new.group
- Y: :
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 58 seconds
-[INFO] Finished at: Tue Sep 16 19:51:09 CEST 2008
-[INFO] Final Memory: 8M/15M
-[INFO] ------------------------------------------------------------------------
+$ mvn archetype:generate -B -DarchetypeCatalog=local
-DarchetypeGroupId=my.group.id -DarchetypeArtifactId=archetype-with-properties
-DarchetypeVersion=2.0 -DgroupId=my.new.group -DartifactId=my-new-artifact
-Dan_additional_property="my new value"
+[INFO] Generating project in Batch mode
+[INFO] Parameter: groupId, Value: my.new.group
+[INFO] Parameter: artifactId, Value: my-new-artifact
+[INFO] Parameter: version, Value: 1.0-SNAPSHOT
+[INFO] Parameter: package, Value: my.new.group
+[INFO] Parameter: an_additional_property, Value: my new value
+[INFO] Project created from Archetype in dir:
/home/user/projects/my-new-artifact
+[INFO] BUILD SUCCESS
```
-As you can see, the additional property is provided by default. As one want to
override the value, one just have to answer `N` to the first confirmation, then
the whole bunch of properties is proposed.
-
-The tree of the generated project show that the only language recognized as
such is groovy. The property `archetype.languages` gives the list of the
languages. The languages are the directories in `src/main` and `src/test` that
have the capacity to contain a "packaged" directory tree. This means that the
`package` value is used to generate the new directory for that language.
-
-```shell
-$ cd my-new-artifact/
- tree
-.
-|____pom.xml
-|____src
-| |____main
-| | |____groovy
-| | | |____my
-| | | | |____new
-| | | | | |____group
-| | | | | | |____App.groovy
-| | |____java
-| | | |____com
-| | | | |____company
-| | | | | |____App.java
-| |____test
-| | |____java
-| | | |____com
-| | | | |____company
-| | | | | |____AppTest.java
-| | |____resources
-| | | |____App.properties
+In interactive mode, the additional property is provided with its default
value. As one want to override the value, one just have to answer `N` to the
first confirmation, then the whole bunch of properties is proposed.
+
+The tree of the generated project is shown here. The property
`archetype.languages` gives the list of the languages. The languages are the
directories in `src/main` and `src/test` that have the capacity to contain a
"packaged" directory tree. This means that the `package` value is used to
generate the new directory for that language.
+
+```text
+my-new-artifact
+├── pom.xml
+└── src
+ ├── main
+ │ ├── groovy
+ │ │ └── my
+ │ │ └── new
+ │ │ └── group
+ │ │ └── App.groovy
+ │ ├── java
+ │ │ └── my
+ │ │ └── new
+ │ │ └── group
+ │ │ └── App.java
+ │ └── resources
+ │ └── App.properties
+ └── test
+ └── java
+ └── my
+ └── new
+ └── group
+ └── AppTest.java
```
The contents of both App.groovy and App.java shows that the only filtered
files are java files. The property `archetype.filteredExtensions` gives the
list of file extensions that permit the filtering. In the example, only the
files whose names ending with `.java` are filtered.
@@ -223,25 +140,15 @@ The contents of both App.groovy and App.java shows that
the only filtered files
$ cat src/main/groovy/my/new/group/App.groovy
package com.company
-class App
-{
+class App {
def value = 'my specific value'
}
-$ cat src/main/java/com/company/App.java
+$ cat src/main/java/my/new/group/App.java
package my.new.group;
-/**
- * Hello world!
- *
- */
-public class App
-{
+public class App {
String value = "my new value";
- public static void main( String[] args )
- {
- System.out.println( "Hello World!" );
- }
}
```
diff --git
a/maven-archetype-plugin/src/site/markdown/examples/generate-batch.md
b/maven-archetype-plugin/src/site/markdown/examples/generate-batch.md
index a10dabb5..f2076723 100644
--- a/maven-archetype-plugin/src/site/markdown/examples/generate-batch.md
+++ b/maven-archetype-plugin/src/site/markdown/examples/generate-batch.md
@@ -32,35 +32,17 @@ It is possible to get rid of the interactivity of the Maven
Archetype Plugin by
- The groupId, artifactId, version and package are the main properties to be
set. Each archetype require these properties. Some archetypes define other
properties; refer to the appropriate archetype's documentation if needed.
```shell
-$ mvn archetype:generate -B -DarchetypeGroupId=org.apache.maven.archetypes
-DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1
-DgroupId=com.company -DartifactId=project -Dversion=1.0-SNAPSHOT
-Dpackage=com.company.project
-[INFO] Scanning for projects...
-[INFO]
-[INFO] ------------------------------------------------------------------------
-[INFO] Building Maven Stub Project (No POM) 1
-[INFO] ------------------------------------------------------------------------
-[INFO]
-[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
>>>
-[INFO]
-[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
<<<
-[INFO]
-[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
---
+$ mvn archetype:generate -B -DarchetypeGroupId=org.apache.maven.archetypes
-DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.5
-DgroupId=com.company -DartifactId=project -Dversion=1.0-SNAPSHOT
-Dpackage=com.company.project
+[INFO] --- archetype:3.4.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
-[INFO] Archetype repository missing. Using the one from
[org.apache.maven.archetypes:maven-archetype-quickstart:1.1] found in catalog
remote
+[INFO] Archetype repository not defined. Using the one from
[org.apache.maven.archetypes:maven-archetype-quickstart:1.5] found in catalog
remote
[INFO]
----------------------------------------------------------------------------
-[INFO] Using following parameters for creating project from Old (1.x)
Archetype: maven-archetype-quickstart:1.1
+[INFO] Using following parameters for creating project from Archetype:
maven-archetype-quickstart:1.5
[INFO]
----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.company
-[INFO] Parameter: packageName, Value: com.company.project
-[INFO] Parameter: package, Value: com.company.project
[INFO] Parameter: artifactId, Value: project
-[INFO] Parameter: basedir, Value: /Users/maven/dev
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
-[INFO] project created from Old (1.x) Archetype in dir:
/Users/maven/dev/project
-[INFO] ------------------------------------------------------------------------
+[INFO] Parameter: package, Value: com.company.project
+[INFO] Project created from Archetype in dir: /home/user/projects/project
[INFO] BUILD SUCCESS
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 9.184s
-[INFO] Finished at: Mon Feb 04 11:53:24 CET 2013
-[INFO] Final Memory: 9M/265M
-[INFO] ------------------------------------------------------------------------
```
diff --git a/maven-archetype-plugin/src/site/markdown/usage.md
b/maven-archetype-plugin/src/site/markdown/usage.md
index aa2964dc..4afbf731 100644
--- a/maven-archetype-plugin/src/site/markdown/usage.md
+++ b/maven-archetype-plugin/src/site/markdown/usage.md
@@ -26,129 +26,88 @@ specific language governing permissions and limitations
under the License.
-->
-# Project creation
+# Usage
-Creating a project from an archetype involves three steps:
+Creating a project from an archetype involves four steps:
-- prepare repository reference
-- the selection of the archetype,
-- the configuration of that archetype,
-- the effective creation of the project from the collected information.
-# Usage
+1. Prepare the repository reference.
+1. Select the archetype.
+1. Configure the archetype.
+1. Create the project from the collected information.
+
+## Prepare the repository reference
In general an archetype is coming from a remote repository. If that repository
can be reached via the setup of your Maven, you're ready to start. In cases
where the repository is not managed and you want to refer to it directly, you
have to add the repository to your `settings.xml`. Read the small set of
instructions on the [Archetype Repository](./archetype-repository.html)-page.
-Calling `archetype:generate` the plugin will first ask to choose the archetype
from the internal catalog. Just enter the number of the archetype.
+## Select and configure the archetype
+
+When you call `archetype:generate`, the plugin first asks you to choose an
archetype from the catalogs. By default, these are the `remote` catalog from
Maven Central, followed by the `local` one: see [Generate project using an
alternative catalog](./examples/generate-alternative-catalog.html). Enter the
number of the archetype.
It then asks you to enter the values for the groupId, the artifactId and the
version of the project to create and the base package for the sources.
It then asks for confirmation of the configuration and performs the creation
of the project.
-In the following example, we selected the quickstart archetype (default value,
which is 15 here but may vary depending on the repository content) and set
`groupId` to `com.company`, `artifactId` to `project`, `version` to `1.0` and
`package` to `com.company.project`.
+The catalog of Maven Central lists thousands of archetypes. The following
example uses the `filter` property, described in [Filtering to reduce archetype
list](#filtering), to keep the list short. It selects the quickstart archetype
in version 1.5 and sets `groupId` to `com.company`, `artifactId` to `project`,
`version` to `1.0` and `package` to `com.company.project`.
```shell
-$ mvn archetype:generate
-[INFO] Scanning for projects...
-[INFO] Searching repository for plugin with prefix: 'archetype'.
-[INFO] ------------------------------------------------------------------------
-[INFO] Building Maven Default Project
-[INFO] task-segment: [archetype:create] (aggregator-style)
-[INFO] ------------------------------------------------------------------------
-[INFO] Preparing archetype:generate
-[INFO] No goals needed for project - skipping
-[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
-[INFO] Setting property: velocimacro.messages.on => 'false'.
-[INFO] Setting property: resource.loader => 'classpath'.
-[INFO] Setting property: resource.manager.logwhenfound => 'false'.
-[INFO] [archetype:generate]
+$ mvn archetype:generate -Dfilter=org.apache.maven.archetypes:quickstart
+[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: internal -> org.appfuse.archetypes:appfuse-basic-jsf (AppFuse archetype for
creating a web application with Hibernate, Spring and JSF)
-2: internal -> org.appfuse.archetypes:appfuse-basic-spring (AppFuse archetype
for creating a web application with Hibernate, Spring and Spring MVC)
-3: internal -> org.appfuse.archetypes:appfuse-basic-struts (AppFuse archetype
for creating a web application with Hibernate, Spring and Struts 2)
-4: internal -> org.appfuse.archetypes:appfuse-basic-tapestry (AppFuse
archetype for creating a web application with Hibernate, Spring and Tapestry 4)
-5: internal -> org.appfuse.archetypes:appfuse-core (AppFuse archetype for
creating a jar application with Hibernate and Spring and XFire)
-6: internal -> org.appfuse.archetypes:appfuse-modular-jsf (AppFuse archetype
for creating a modular application with Hibernate, Spring and JSF)
-7: internal -> org.appfuse.archetypes:appfuse-modular-spring (AppFuse
archetype for creating a modular application with Hibernate, Spring and Spring
MVC)
-8: internal -> org.appfuse.archetypes:appfuse-modular-struts (AppFuse
archetype for creating a modular application with Hibernate, Spring and Struts
2)
-9: internal -> org.appfuse.archetypes:appfuse-modular-tapestry (AppFuse
archetype for creating a modular application with Hibernate, Spring and
Tapestry 4)
-10: internal -> org.apache.maven.archetypes:maven-archetype-j2ee-simple (A
simple J2EE Java application)
-11: internal -> org.apache.maven.archetypes:maven-archetype-marmalade-mojo (A
Maven plugin development project using marmalade)
-12: internal -> org.apache.maven.archetypes:maven-archetype-mojo (A Maven Java
plugin development project)
-13: internal -> org.apache.maven.archetypes:maven-archetype-portlet (A simple
portlet application)
-14: internal -> org.apache.maven.archetypes:maven-archetype-profiles ()
-15: internal -> org.apache.maven.archetypes:maven-archetype-quickstart ()
-16: internal -> org.apache.maven.archetypes:maven-archetype-site-simple (A
simple site generation project)
-17: internal -> org.apache.maven.archetypes:maven-archetype-site (A more
complex site project)
-18: internal -> org.apache.maven.archetypes:maven-archetype-webapp (A simple
Java web application)
-19: internal -> org.apache.struts:struts2-archetype-starter (A starter Struts
2 application with Sitemesh, DWR, and Spring)
-20: internal -> org.apache.struts:struts2-archetype-blank (A minimal Struts 2
application)
-21: internal -> org.apache.struts:struts2-archetype-portlet (A minimal Struts
2 application that can be deployed as a portlet)
-22: internal -> org.apache.struts:struts2-archetype-dbportlet (A starter
Struts 2 portlet that demonstrates a simple CRUD interface with db backing)
-23: internal -> org.apache.struts:struts2-archetype-plugin (A Struts 2 plugin)
-Choose a number or apply filter (format: [groupId:]artifactId, case sensitive
contains): 15:
-Choose org.apache.maven.archetypes:maven-archetype-quickstart version:
+1: remote -> org.apache.maven.archetypes:maven-archetype-quickstart (An
archetype which contains a sample Maven project.)
+Choose a number or apply filter (format: [groupId:]artifactId, case sensitive
contains): 1: 1
+Choose org.apache.maven.archetypes:maven-archetype-quickstart version:
1: 1.0-alpha-1
-2: 1.0-alpha-2
-3: 1.0-alpha-3
-4: 1.0-alpha-4
-5: 1.0
-6: 1.1
-Choose a number: 6:
-Define value for groupId: : com.company
-Define value for artifactId: : project
-Define value for version: : 1.0
-Define value for package: : com.company.project
+...
+9: 1.5
+10: 1.6-SNAPSHOT
+Choose a number: 10: 9
+Define value for property 'groupId': com.company
+Define value for property 'artifactId': project
+Define value for property 'version' 1.0-SNAPSHOT: 1.0
+Define value for property 'package' com.company: com.company.project
Confirm properties configuration:
+javaCompilerVersion: 17
+junitVersion: 5.11.0
groupId: com.company
artifactId: project
version: 1.0
package: com.company.project
- Y: :
-[INFO]
----------------------------------------------------------------------------
-[INFO] Using following parameters for creating OldArchetype:
maven-archetype-quickstart:RELEASE
-[INFO]
----------------------------------------------------------------------------
-[INFO] Parameter: groupId, Value: com.company
-[INFO] Parameter: packageName, Value: com.company.project
-[INFO] Parameter: package, Value: com.company.project
-[INFO] Parameter: artifactId, Value: project
-[INFO] Parameter: basedir, Value: /home/local/rafale/projects/tmp
-[INFO] Parameter: version, Value: 1.0
-[INFO] OldArchetype created in dir: /home/local/rafale/projects/tmp/project
-[INFO] ------------------------------------------------------------------------
-[INFO] BUILD SUCCESSFUL
-[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 54 seconds
-[INFO] Finished at: Fri Aug 26 23:01:01 GMT 2011
-[INFO] Final Memory: 10M/25M
-[INFO] ------------------------------------------------------------------------
+ Y:
+[INFO] Using following parameters for creating project from Archetype:
maven-archetype-quickstart:1.5
+[INFO] Project created from Archetype in dir: /home/user/projects/project
+[INFO] BUILD SUCCESS
```
-Here's the resulting tree of the created project
+Here's the resulting tree of the created project.
-```shell
-$ tree project
+```text
project
-|-- pom.xml
-`-- src
- |-- main
- | `-- java
- | `-- com
- | `-- company
- | `-- project
- | `-- App.java
- `-- test
- `-- java
- `-- com
- `-- company
- `-- project
- `-- AppTest.java
-
-11 directories, 3 files
+├── .mvn
+│ ├── jvm.config
+│ └── maven.config
+├── pom.xml
+└── src
+ ├── main
+ │ └── java
+ │ └── com
+ │ └── company
+ │ └── project
+ │ └── App.java
+ └── test
+ └── java
+ └── com
+ └── company
+ └── project
+ └── AppTest.java
```
-# Filtering to reduce archetype list
+<a id="filtering"></a>
+
+## Filtering to reduce archetype list
-As of version 2.1, you can reduce the list of displayed archetypes. The filter
use the following format: `[groupId:]artifactId`. If you use single word
without `:`, only artifactId will be checked. The filtering applied is a case
sensitive contains on the artifactId (and groupId if set).
+You can reduce the list of displayed archetypes. The filter use the following
format: `[groupId:]artifactId`. If you use single word without `:`, only
artifactId will be checked. The filtering applied is a case sensitive contains
on the artifactId (and groupId if set).
Two options