This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-archetypes.git
The following commit(s) were added to refs/heads/master by this push: new c5165de [MARCHETYPES-77] Allow to provide additional parameters for quickstart archetype c5165de is described below commit c5165decf2865eb813a671cc5e2a9894c070baca Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Sat Aug 17 22:01:13 2024 +0200 [MARCHETYPES-77] Allow to provide additional parameters for quickstart archetype --- maven-archetype-quickstart/pom.xml | 11 ++++------ .../META-INF/maven/archetype-metadata.xml | 8 ++++++++ .../resources-filtered/archetype-resources/pom.xml | 8 -------- .../src/site/apt/index.apt.vm | 24 +++++++++++++++------- .../projects/it-basic/archetype.properties | 3 ++- .../projects/it-java-11/archetype.properties | 1 + .../projects/it-java-7/archetype.properties | 1 + 7 files changed, 33 insertions(+), 23 deletions(-) diff --git a/maven-archetype-quickstart/pom.xml b/maven-archetype-quickstart/pom.xml index 91f30b3..385a2ae 100644 --- a/maven-archetype-quickstart/pom.xml +++ b/maven-archetype-quickstart/pom.xml @@ -32,13 +32,10 @@ under the License. <name>Maven Quickstart Archetype</name> <description>An archetype which contains a sample Maven project.</description> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.13.1</version> - </dependency> - </dependencies> + <properties> + <javaCompilerVersionDefault>8</javaCompilerVersionDefault> + <junitVersionDefault>4.13.1</junitVersionDefault> + </properties> <build> <testResources> diff --git a/maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml b/maven-archetype-quickstart/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml similarity index 83% rename from maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml rename to maven-archetype-quickstart/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml index b90f6b9..6dd4d8a 100644 --- a/maven-archetype-quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/maven-archetype-quickstart/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml @@ -34,4 +34,12 @@ under the License. <directory>.mvn</directory> </fileSet> </fileSets> + <requiredProperties> + <requiredProperty key="javaCompilerVersion"> + <defaultValue>${javaCompilerVersionDefault}</defaultValue> + </requiredProperty> + <requiredProperty key="junitVersion"> + <defaultValue>${junitVersionDefault}</defaultValue> + </requiredProperty> + </requiredProperties> </archetype-descriptor> diff --git a/maven-archetype-quickstart/src/main/resources-filtered/archetype-resources/pom.xml b/maven-archetype-quickstart/src/main/resources-filtered/archetype-resources/pom.xml index 1c5c161..02b5945 100644 --- a/maven-archetype-quickstart/src/main/resources-filtered/archetype-resources/pom.xml +++ b/maven-archetype-quickstart/src/main/resources-filtered/archetype-resources/pom.xml @@ -45,19 +45,11 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> -#if ( ${javaCompilerVersion} == $null ) -#compilerProperties( "8" ) -#else #compilerProperties( ${javaCompilerVersion} ) -#end </properties> <dependencies> -#if ( ${junitVersion} == $null ) -#junit( "4.13.1" ) -#else #junit( ${junitVersion} ) -#end </dependencies> <build> diff --git a/maven-archetype-quickstart/src/site/apt/index.apt.vm b/maven-archetype-quickstart/src/site/apt/index.apt.vm index 160e29b..5412bc8 100644 --- a/maven-archetype-quickstart/src/site/apt/index.apt.vm +++ b/maven-archetype-quickstart/src/site/apt/index.apt.vm @@ -30,7 +30,7 @@ ${project.name} <<<${project.artifactId}>>> is an archetype which generates a sample Maven project: -+----+ +---- project |-- .mvn @@ -47,22 +47,32 @@ project `-- $package `-- AppTest.java -+----+ +---- * Usage To generate a new project from this archetype, type: -+----+ +---- mvn archetype:generate -DarchetypeGroupId=${project.groupId} -DarchetypeArtifactId=${project.artifactId} -DarchetypeVersion=${project.version} -+----+ +---- -The above command might not work on Windows or certain operating systems as-is. You can quote the parameters like this: + Archetype provide additional parameters: -+----+ +*---------------------------*-----------------------------------* + Name | Default +*---------------------------*-----------------------------------* + <<<javaCompilerVersion>>> | <<${javaCompilerVersionDefault}>> +*---------------------------*-----------------------------------* + <<<junitVersion>>> | <<${junitVersionDefault}>> +*---------------------------*-----------------------------------* + + The above command might not work on Windows or certain operating systems as-is. You can quote the parameters like this: + +---- mvn archetype:generate "-DarchetypeGroupId=${project.groupId}" "-DarchetypeArtifactId=${project.artifactId}" "-DarchetypeVersion=${project.version}" -+----+ +---- diff --git a/maven-archetype-quickstart/src/test/resources/projects/it-basic/archetype.properties b/maven-archetype-quickstart/src/test/resources/projects/it-basic/archetype.properties index c123e46..22cd3c5 100644 --- a/maven-archetype-quickstart/src/test/resources/projects/it-basic/archetype.properties +++ b/maven-archetype-quickstart/src/test/resources/projects/it-basic/archetype.properties @@ -2,4 +2,5 @@ groupId=archetype.it artifactId=basic-quickstart version=0.1-SNAPSHOT package=it.pkg - +javaCompilerVersion=8 +junitVersion=4.13.1 diff --git a/maven-archetype-quickstart/src/test/resources/projects/it-java-11/archetype.properties b/maven-archetype-quickstart/src/test/resources/projects/it-java-11/archetype.properties index 61d6c7d..b890d7e 100644 --- a/maven-archetype-quickstart/src/test/resources/projects/it-java-11/archetype.properties +++ b/maven-archetype-quickstart/src/test/resources/projects/it-java-11/archetype.properties @@ -3,3 +3,4 @@ artifactId=java-11-quickstart version=0.1-SNAPSHOT package=it.pkg javaCompilerVersion=11 +junitVersion=4.13.1 diff --git a/maven-archetype-quickstart/src/test/resources/projects/it-java-7/archetype.properties b/maven-archetype-quickstart/src/test/resources/projects/it-java-7/archetype.properties index f03bcf4..ae4abd2 100644 --- a/maven-archetype-quickstart/src/test/resources/projects/it-java-7/archetype.properties +++ b/maven-archetype-quickstart/src/test/resources/projects/it-java-7/archetype.properties @@ -3,3 +3,4 @@ artifactId=java-7-quickstart version=0.1-SNAPSHOT package=it.pkg javaCompilerVersion=7 +junitVersion=4.13.1