From 72c05afaa505a4ecd2b6259be6493a3c0c6373d5 Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde <27761321+Giovds@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:28:44 +0100 Subject: [PATCH 1/8] [ARCHETYPE-274] Setup with Copilot: https://copilot-workspace.githubnext.com/Giovds/maven-archetype?s=2d10 --- .../DefaultFilesetArchetypeGenerator.java | 10 ++++++ .../META-INF/maven/archetype-metadata.xml | 6 ++++ .../src/main/mdo/archetype-descriptor.mdo | 7 ++++ test-archetype/pom.xml | 20 +++++++++++ .../META-INF/maven/archetype-metadata.xml | 35 +++++++++++++++++++ .../resources/archetype-resources/pom.xml | 23 ++++++++++++ .../src/main/resources/example.json | 3 ++ .../resources/archetype-resources/src/pom.xml | 23 ++++++++++++ tmp/test/pom.xml | 23 ++++++++++++ tmp/test/src/main/resources/example.json | 3 ++ 10 files changed, 153 insertions(+) create mode 100644 test-archetype/pom.xml create mode 100644 test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml create mode 100644 test-archetype/src/main/resources/archetype-resources/pom.xml create mode 100644 test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json create mode 100644 test-archetype/src/main/resources/archetype-resources/src/pom.xml create mode 100644 tmp/test/pom.xml create mode 100644 tmp/test/src/main/resources/example.json diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java index 8ce51c66b..2a2ddf4d4 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java @@ -772,6 +772,16 @@ private void processTemplates( FileSet fileSet = iterator.next(); count++; + // Evaluate the includeCondition attribute + String includeCondition = fileSet.getIncludeCondition(); + if (includeCondition != null && !includeCondition.isEmpty()) { + String evaluatedCondition = evaluateExpression(context, "includeCondition", includeCondition); + if (!Boolean.parseBoolean(evaluatedCondition)) { + LOGGER.debug("Skipping fileset " + fileSet + " due to includeCondition: " + includeCondition); + continue; + } + } + List fileSetResources = archetypeFilesResolver.filterFiles(moduleOffset, fileSet, archetypeResources); diff --git a/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml b/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml index 1a061c4a5..af3d314d6 100644 --- a/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml +++ b/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml @@ -87,6 +87,12 @@ **/*.mdo + + src/main/extra + + **/* + + diff --git a/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo b/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo index f49089fee..873f15dc1 100644 --- a/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo +++ b/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo @@ -162,6 +162,13 @@ false Encoding to use when filtering content. + + includeCondition + 1.0.0+ + String + false + Condition to include the fileset based on a property value. + directory 1.0.0+ diff --git a/test-archetype/pom.xml b/test-archetype/pom.xml new file mode 100644 index 000000000..d59c2a7e5 --- /dev/null +++ b/test-archetype/pom.xml @@ -0,0 +1,20 @@ + + 4.0.0 + + com.examples + archetype-test + 1.0-SNAPSHOT + + maven-archetype + + + + org.apache.maven.archetype + archetype-packaging + 3.1.1 + + + + + diff --git a/test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 000000000..4c3be22e5 --- /dev/null +++ b/test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,35 @@ + + + + + + + + + src/main/java + + **/*.java + + + + src/main/resources + + **/*.properties + + + + src/test/java + + **/*.java + + + + src/main/resources + + **/*.json + + + + \ No newline at end of file diff --git a/test-archetype/src/main/resources/archetype-resources/pom.xml b/test-archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 000000000..6b228bbba --- /dev/null +++ b/test-archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + ${groupId} + ${artifactId} + ${version} + + + ${my-property} + ${my-default-property} + 21 + + + + + org.hibernate.orm + hibernate-core + 6.6.0.Final + + + + diff --git a/test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json b/test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json new file mode 100644 index 000000000..973ff84d0 --- /dev/null +++ b/test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json @@ -0,0 +1,3 @@ +{ + "something": "Hello, World!" +} \ No newline at end of file diff --git a/test-archetype/src/main/resources/archetype-resources/src/pom.xml b/test-archetype/src/main/resources/archetype-resources/src/pom.xml new file mode 100644 index 000000000..6b228bbba --- /dev/null +++ b/test-archetype/src/main/resources/archetype-resources/src/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + ${groupId} + ${artifactId} + ${version} + + + ${my-property} + ${my-default-property} + 21 + + + + + org.hibernate.orm + hibernate-core + 6.6.0.Final + + + + diff --git a/tmp/test/pom.xml b/tmp/test/pom.xml new file mode 100644 index 000000000..be660e801 --- /dev/null +++ b/tmp/test/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + com.example + test + 1.0-SNAPSHOT + + + ${my-property} + ${my-default-property} + 21 + + + + + org.hibernate.orm + hibernate-core + 6.6.0.Final + + + + diff --git a/tmp/test/src/main/resources/example.json b/tmp/test/src/main/resources/example.json new file mode 100644 index 000000000..973ff84d0 --- /dev/null +++ b/tmp/test/src/main/resources/example.json @@ -0,0 +1,3 @@ +{ + "something": "Hello, World!" +} \ No newline at end of file From 8c2bbd162ac1fa14e4478c5619778a498bcc361a Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 22 Nov 2024 10:15:53 +0100 Subject: [PATCH 2/8] [ARCHETYPE-274] Log different debug message and remove temp test files --- .../creator/FilesetArchetypeCreator.java | 5 ++-- .../DefaultFilesetArchetypeGenerator.java | 5 ++-- tmp/test/pom.xml | 23 ------------------- tmp/test/src/main/resources/example.json | 3 --- 4 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 tmp/test/pom.xml delete mode 100644 tmp/test/src/main/resources/example.json diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java index 846787f68..f7905e4c2 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java @@ -178,8 +178,9 @@ public void createArchetype(ArchetypeCreationRequest request, ArchetypeCreationR Model pom = pomManager.readPom(project.getFile()); List excludePatterns = configurationProperties.getProperty(Constants.EXCLUDE_PATTERNS) != null - ? Arrays.asList( - StringUtils.split(configurationProperties.getProperty(Constants.EXCLUDE_PATTERNS), ",")) + ? Arrays.asList(configurationProperties + .getProperty(Constants.EXCLUDE_PATTERNS) + .split(",")) : Collections.emptyList(); List fileNames = resolveFileNames(pom, basedir, excludePatterns); diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java index 2a2ddf4d4..a8777008d 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java @@ -773,11 +773,12 @@ private void processTemplates( count++; // Evaluate the includeCondition attribute - String includeCondition = fileSet.getIncludeCondition(); + final String includeCondition = fileSet.getIncludeCondition(); if (includeCondition != null && !includeCondition.isEmpty()) { String evaluatedCondition = evaluateExpression(context, "includeCondition", includeCondition); if (!Boolean.parseBoolean(evaluatedCondition)) { - LOGGER.debug("Skipping fileset " + fileSet + " due to includeCondition: " + includeCondition); + LOGGER.debug("Skipping fileset " + fileSet + " due to includeCondition: " + includeCondition + + " being: " + evaluatedCondition); continue; } } diff --git a/tmp/test/pom.xml b/tmp/test/pom.xml deleted file mode 100644 index be660e801..000000000 --- a/tmp/test/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - com.example - test - 1.0-SNAPSHOT - - - ${my-property} - ${my-default-property} - 21 - - - - - org.hibernate.orm - hibernate-core - 6.6.0.Final - - - - diff --git a/tmp/test/src/main/resources/example.json b/tmp/test/src/main/resources/example.json deleted file mode 100644 index 973ff84d0..000000000 --- a/tmp/test/src/main/resources/example.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "something": "Hello, World!" -} \ No newline at end of file From 2f76cef6a643927f46e1cf68d7caf7675645f37c Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 22 Nov 2024 12:04:24 +0100 Subject: [PATCH 3/8] [ARCHETYPE-274] Add integration test --- .../archetype.properties | 18 ++++++ .../archetype/pom.xml | 44 ++++++++++++++ .../META-INF/maven/archetype-metadata.xml | 60 +++++++++++++++++++ .../resources/archetype-resources/pom.xml | 28 +++++++++ .../src/main/java/App.java | 5 ++ .../main/resources/exclude-with-filter.txt | 1 + .../main/resources/exclude-without-filter.txt | 1 + .../main/resources/include-with-filter.txt | 1 + .../main/resources/include-without-filter.txt | 1 + .../invoker.properties | 22 +++++++ .../pom.xml | 48 +++++++++++++++ .../project.properties | 28 +++++++++ .../verify.groovy | 34 +++++++++++ test-archetype/pom.xml | 20 ------- .../META-INF/maven/archetype-metadata.xml | 35 ----------- .../resources/archetype-resources/pom.xml | 23 ------- .../src/main/resources/example.json | 3 - .../resources/archetype-resources/src/pom.xml | 23 ------- 18 files changed, 291 insertions(+), 104 deletions(-) create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype.properties create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/pom.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/invoker.properties create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/pom.xml create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties create mode 100644 maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy delete mode 100644 test-archetype/pom.xml delete mode 100644 test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml delete mode 100644 test-archetype/src/main/resources/archetype-resources/pom.xml delete mode 100644 test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json delete mode 100644 test-archetype/src/main/resources/archetype-resources/src/pom.xml diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype.properties new file mode 100644 index 000000000..74cf9cb46 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +excludePatterns=build.log,invoker.properties,verify.groovy diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/pom.xml new file mode 100644 index 000000000..ed118c27e --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + + org.apache.maven.plugins.archetype.its + archetype274-parent + 1.0-SNAPSHOT + + archetype274-archetype + maven-archetype + + + + + org.apache.maven.plugins + maven-archetype-plugin + true + + src/main/resources + + + + + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 000000000..8adfcbb7b --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + src/main/java + + **/*.java + + + + src/main/resources + + **/include-without-filter.txt + + + + src/main/resources + + **/include-with-filter.txt + + + + src/main/resources + + **/exclude-with-filter.txt + + + + src/main/resources + + **/exclude-without-filter.txt + + + + + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 000000000..98b338696 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + ${groupId} + ${artifactId} + ${version} + pom + + \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java new file mode 100644 index 000000000..6004613c7 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java @@ -0,0 +1,5 @@ +public class App { + public static void main(String[] args) { + System.out.println("This file should not be included"); + } +} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt new file mode 100644 index 000000000..6cc706403 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt @@ -0,0 +1 @@ +this should be excluded: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt new file mode 100644 index 000000000..6cc706403 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt @@ -0,0 +1 @@ +this should be excluded: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt new file mode 100644 index 000000000..d3932e1d4 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt @@ -0,0 +1 @@ +this should be included: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt new file mode 100644 index 000000000..d3932e1d4 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt @@ -0,0 +1 @@ +this should be included: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/invoker.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/invoker.properties new file mode 100644 index 000000000..ebd19f4a1 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/invoker.properties @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals.1 = install +invoker.project.1 = archetype + +invoker.goals.2 = org.apache.maven.plugins:maven-archetype-plugin:${project.version}:generate +invoker.userPropertiesFile = project.properties diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/pom.xml new file mode 100644 index 000000000..e4202899d --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + org.apache.maven.plugins.archetype.its + archetype274-parent + 1.0-SNAPSHOT + pom + + + + + org.apache.maven.archetype + archetype-packaging + @project.version@ + + + + + + + org.apache.maven.plugins + maven-archetype-plugin + @project.version@ + + + + + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties new file mode 100644 index 000000000..29331fbef --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +archetypeGroupId=org.apache.maven.plugins.archetype.its +archetypeArtifactId=archetype274-archetype +archetypeVersion=1.0-SNAPSHOT + +groupId=com.company +artifactId=myArtifactId +version=1.0-SNAPSHOT +package=com.company.project + +extraSupport=true +anotherSupport=false \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy new file mode 100644 index 000000000..2f7f7a364 --- /dev/null +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File + +def mainJava = new File(basedir, "/myArtifactId/src/main/java") +def includeFirstResource = new File(basedir, "/myArtifactId/src/main/resources/include-with-filter.txt") +def includeSecondResource = new File(basedir, "/myArtifactId/src/main/resources/include-without-filter.txt") +def excludeFirstResource = new File(basedir, "/myArtifactId/src/main/resources/exclude-with-filter.txt") +def excludeSecondResource = new File(basedir, "/myArtifactId/src/main/resources/exclude-without-filter.txt") + +assert mainJava.exists() : "${mainJava} should be present." +assert includeFirstResource.exists() : "${includeFirstResource} should be present." +assert includeSecondResource.exists() : "${includeSecondResource} should be present." +assert !excludeFirstResource.exists() : "${excludeFirstResource} should not be present." +assert !excludeSecondResource.exists() : "${excludeSecondResource} should not be present." + + diff --git a/test-archetype/pom.xml b/test-archetype/pom.xml deleted file mode 100644 index d59c2a7e5..000000000 --- a/test-archetype/pom.xml +++ /dev/null @@ -1,20 +0,0 @@ - - 4.0.0 - - com.examples - archetype-test - 1.0-SNAPSHOT - - maven-archetype - - - - org.apache.maven.archetype - archetype-packaging - 3.1.1 - - - - - diff --git a/test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 4c3be22e5..000000000 --- a/test-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - src/main/java - - **/*.java - - - - src/main/resources - - **/*.properties - - - - src/test/java - - **/*.java - - - - src/main/resources - - **/*.json - - - - \ No newline at end of file diff --git a/test-archetype/src/main/resources/archetype-resources/pom.xml b/test-archetype/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index 6b228bbba..000000000 --- a/test-archetype/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - ${groupId} - ${artifactId} - ${version} - - - ${my-property} - ${my-default-property} - 21 - - - - - org.hibernate.orm - hibernate-core - 6.6.0.Final - - - - diff --git a/test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json b/test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json deleted file mode 100644 index 973ff84d0..000000000 --- a/test-archetype/src/main/resources/archetype-resources/src/main/resources/example.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "something": "Hello, World!" -} \ No newline at end of file diff --git a/test-archetype/src/main/resources/archetype-resources/src/pom.xml b/test-archetype/src/main/resources/archetype-resources/src/pom.xml deleted file mode 100644 index 6b228bbba..000000000 --- a/test-archetype/src/main/resources/archetype-resources/src/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 4.0.0 - - ${groupId} - ${artifactId} - ${version} - - - ${my-property} - ${my-default-property} - 21 - - - - - org.hibernate.orm - hibernate-core - 6.6.0.Final - - - - From 32685c2bd501942a7d7ef5037353dd9efaf69d3a Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 22 Nov 2024 13:04:01 +0100 Subject: [PATCH 4/8] [ARCHETYPE-274] Minor improvements --- .../generator/DefaultFilesetArchetypeGenerator.java | 6 ++---- .../basic-1.0/META-INF/maven/archetype-metadata.xml | 6 ------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java index a8777008d..3a32b20c2 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java @@ -772,13 +772,11 @@ private void processTemplates( FileSet fileSet = iterator.next(); count++; - // Evaluate the includeCondition attribute final String includeCondition = fileSet.getIncludeCondition(); if (includeCondition != null && !includeCondition.isEmpty()) { - String evaluatedCondition = evaluateExpression(context, "includeCondition", includeCondition); + final String evaluatedCondition = evaluateExpression(context, "includeCondition", includeCondition); if (!Boolean.parseBoolean(evaluatedCondition)) { - LOGGER.debug("Skipping fileset " + fileSet + " due to includeCondition: " + includeCondition - + " being: " + evaluatedCondition); + LOGGER.debug(String.format("Skipping fileset %s due to includeCondition: %s being: %s", fileSet, includeCondition, evaluatedCondition)); continue; } } diff --git a/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml b/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml index af3d314d6..1a061c4a5 100644 --- a/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml +++ b/archetype-common/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml @@ -87,12 +87,6 @@ **/*.mdo - - src/main/extra - - **/* - - From e980722043f699b4c0917a4317c645e1c6171f97 Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 22 Nov 2024 13:18:28 +0100 Subject: [PATCH 5/8] [ARCHETYPE-274] Add Lincense to files and validate file content --- .../DefaultFilesetArchetypeGenerator.java | 4 +++- .../src/main/java/App.java | 19 +++++++++++++++++++ .../main/resources/exclude-with-filter.txt | 19 +++++++++++++++++++ .../main/resources/exclude-without-filter.txt | 19 +++++++++++++++++++ .../main/resources/include-with-filter.txt | 19 +++++++++++++++++++ .../main/resources/include-without-filter.txt | 19 +++++++++++++++++++ .../verify.groovy | 3 ++- 7 files changed, 100 insertions(+), 2 deletions(-) diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java index 3a32b20c2..c6adbf492 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java @@ -776,7 +776,9 @@ private void processTemplates( if (includeCondition != null && !includeCondition.isEmpty()) { final String evaluatedCondition = evaluateExpression(context, "includeCondition", includeCondition); if (!Boolean.parseBoolean(evaluatedCondition)) { - LOGGER.debug(String.format("Skipping fileset %s due to includeCondition: %s being: %s", fileSet, includeCondition, evaluatedCondition)); + LOGGER.debug(String.format( + "Skipping fileset %s due to includeCondition: %s being: %s", + fileSet, includeCondition, evaluatedCondition)); continue; } } diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java index 6004613c7..7bb0a072a 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + public class App { public static void main(String[] args) { System.out.println("This file should not be included"); diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt index 6cc706403..ccab0c2bb 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-with-filter.txt @@ -1 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ + this should be excluded: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt index 6cc706403..ccab0c2bb 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/exclude-without-filter.txt @@ -1 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ + this should be excluded: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt index d3932e1d4..d0e51a8d8 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-with-filter.txt @@ -1 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ + this should be included: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt index d3932e1d4..d0e51a8d8 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/resources/include-without-filter.txt @@ -1 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ + this should be included: ${package} \ No newline at end of file diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy index 2f7f7a364..1b4a6547c 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy @@ -31,4 +31,5 @@ assert includeSecondResource.exists() : "${includeSecondResource} should be pres assert !excludeFirstResource.exists() : "${excludeFirstResource} should not be present." assert !excludeSecondResource.exists() : "${excludeSecondResource} should not be present." - +assert includeFirstResource.text.contains("com.company.myArtifactId") : "${includeFirstResource} should contain the expected content." +assert includeSecondResource.text.contains("\${package}") : "${includeSecondResource} should contain the expected content." From 99ec1f59e53be28057da1a4ed8fe31963776b1e2 Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 22 Nov 2024 13:26:56 +0100 Subject: [PATCH 6/8] [ARCHETYPE-274] Correct file content check --- .../projects/ARCHETYPE-274_conditional_filesets/verify.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy index 1b4a6547c..99511b0ac 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/verify.groovy @@ -31,5 +31,5 @@ assert includeSecondResource.exists() : "${includeSecondResource} should be pres assert !excludeFirstResource.exists() : "${excludeFirstResource} should not be present." assert !excludeSecondResource.exists() : "${excludeSecondResource} should not be present." -assert includeFirstResource.text.contains("com.company.myArtifactId") : "${includeFirstResource} should contain the expected content." +assert includeFirstResource.text.contains("com.company") : "${includeFirstResource} should contain the expected content." assert includeSecondResource.text.contains("\${package}") : "${includeSecondResource} should contain the expected content." From 6c5e4b782f454acb5f89ab587d23b470e12b9b48 Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 6 Dec 2024 17:57:44 +0100 Subject: [PATCH 7/8] [ARCHETYPE-274] run spotless with require new line at EOF --- NOTICE.txt | 1 - .../src/test/archetypes/basic-1.0/archetype-resources/pom.xml | 2 +- .../src/test/archetypes/fileset-1.0/archetype-resources/pom.xml | 2 +- .../fileset-1.0/archetype-resources/subproject/pom.xml | 2 +- .../archetype-resources/subproject/subsubproject/pom.xml | 2 +- .../src/test/archetypes/old-1.0/archetype-resources/pom.xml | 2 +- .../src/test/archetypes/partial-1.0/archetype-resources/pom.xml | 2 +- .../maven-archetype-quickstart-1.0-alpha-1-SNAPSHOT.pom | 2 +- archetype-samples/pom.xml | 2 +- deploySite.sh | 1 - .../resources/archetype-resources/__projectName__-test2/pom.xml | 2 +- .../archetype-resources/__rootArtifactId__-test1/pom.xml | 2 +- .../archetype/src/main/resources/archetype-resources/pom.xml | 2 +- .../archetype/src/main/resources/archetype-resources/pom.xml | 2 +- .../main/resources/archetype-resources/src/main/java/App.java | 2 +- .../ARCHETYPE-274_conditional_filesets/project.properties | 2 +- .../archetype/src/main/resources/archetype-resources/pom.xml | 2 +- .../archetype/src/main/resources/archetype-resources/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 1 - .../src/test/resources/projects/basic/reference/pom.xml | 1 - maven-archetype-plugin/src/it/projects/roundtrip-multi/pom.xml | 2 +- .../src/it/projects/roundtrip-multi/proficio-api/pom.xml | 2 +- .../src/it/projects/roundtrip-multi/proficio-cli/pom.xml | 2 +- .../src/it/projects/roundtrip-multi/proficio-core/pom.xml | 2 +- .../src/it/projects/roundtrip-multi/proficio-model/pom.xml | 2 +- .../src/it/projects/roundtrip-multi/proficio-stores/pom.xml | 2 +- .../proficio-stores/proficio-store-memory/pom.xml | 2 +- .../proficio-stores/proficio-store-xstream/pom.xml | 2 +- 28 files changed, 24 insertions(+), 28 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 24e228b4b..53a591cab 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,3 +1,2 @@ This product includes software developed by The Apache Software Foundation (http://www.apache.org/). - diff --git a/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml index bb055cf18..c02a87926 100644 --- a/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml +++ b/archetype-common/src/test/archetypes/basic-1.0/archetype-resources/pom.xml @@ -40,4 +40,4 @@ - \ No newline at end of file + diff --git a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml index 33d6dcfa7..0cae4563f 100644 --- a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml +++ b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml @@ -35,4 +35,4 @@ subproject - \ No newline at end of file + diff --git a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml index 3ae5c9a4a..4f0d2d1f9 100644 --- a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml +++ b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/pom.xml @@ -41,4 +41,4 @@ subsubproject - \ No newline at end of file + diff --git a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml index 4c2bc239f..657a8f096 100644 --- a/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml +++ b/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/pom.xml @@ -37,4 +37,4 @@ Maven archetype Test Subsubfolder jar - \ No newline at end of file + diff --git a/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml index e13e2cd15..0f41174db 100644 --- a/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml +++ b/archetype-common/src/test/archetypes/old-1.0/archetype-resources/pom.xml @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml b/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml index ce15f3ed6..5e0149429 100644 --- a/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml +++ b/archetype-common/src/test/archetypes/partial-1.0/archetype-resources/pom.xml @@ -58,4 +58,4 @@ - \ No newline at end of file + diff --git a/archetype-common/src/test/repository/org/apache/maven/archetypes/maven-archetype-quickstart/1.0-alpha-1-SNAPSHOT/maven-archetype-quickstart-1.0-alpha-1-SNAPSHOT.pom b/archetype-common/src/test/repository/org/apache/maven/archetypes/maven-archetype-quickstart/1.0-alpha-1-SNAPSHOT/maven-archetype-quickstart-1.0-alpha-1-SNAPSHOT.pom index ee2132907..81fcae6a1 100644 --- a/archetype-common/src/test/repository/org/apache/maven/archetypes/maven-archetype-quickstart/1.0-alpha-1-SNAPSHOT/maven-archetype-quickstart-1.0-alpha-1-SNAPSHOT.pom +++ b/archetype-common/src/test/repository/org/apache/maven/archetypes/maven-archetype-quickstart/1.0-alpha-1-SNAPSHOT/maven-archetype-quickstart-1.0-alpha-1-SNAPSHOT.pom @@ -23,4 +23,4 @@ 4.0.0 maven-archetype-quickstart 1.0-alpha-1-SNAPSHOT - \ No newline at end of file + diff --git a/archetype-samples/pom.xml b/archetype-samples/pom.xml index 145c10d94..f0f76df6b 100644 --- a/archetype-samples/pom.xml +++ b/archetype-samples/pom.xml @@ -26,4 +26,4 @@ archetype.properties - \ No newline at end of file + diff --git a/deploySite.sh b/deploySite.sh index 6c9bbe20d..a2d491182 100644 --- a/deploySite.sh +++ b/deploySite.sh @@ -21,4 +21,3 @@ mvn package site site:stage -Preporting $@ mvn scm-publish:publish-scm $@ - diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__projectName__-test2/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__projectName__-test2/pom.xml index 05d041671..b0af2139e 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__projectName__-test2/pom.xml +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__projectName__-test2/pom.xml @@ -30,4 +30,4 @@ under the License. ${projectName}-test2 - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__rootArtifactId__-test1/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__rootArtifactId__-test1/pom.xml index 1cf27a3f7..450a416c4 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__rootArtifactId__-test1/pom.xml +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/__rootArtifactId__-test1/pom.xml @@ -30,4 +30,4 @@ under the License. ${rootArtifactId}-test1 - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/pom.xml index 93ebda490..e9bfe6e72 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/pom.xml +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/src/main/resources/archetype-resources/pom.xml @@ -33,4 +33,4 @@ under the License. ${projectName}-test2 - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml index 98b338696..15f4c5838 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/pom.xml @@ -25,4 +25,4 @@ under the License. ${version} pom - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java index 7bb0a072a..136fea7ce 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/archetype/src/main/resources/archetype-resources/src/main/java/App.java @@ -21,4 +21,4 @@ public class App { public static void main(String[] args) { System.out.println("This file should not be included"); } -} \ No newline at end of file +} diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties index 29331fbef..aff8740fc 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-274_conditional_filesets/project.properties @@ -25,4 +25,4 @@ version=1.0-SNAPSHOT package=com.company.project extraSupport=true -anotherSupport=false \ No newline at end of file +anotherSupport=false diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml index 4f81a0f7a..e5f0e3c88 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/src/main/resources/archetype-resources/pom.xml @@ -28,4 +28,4 @@ under the License. ${version} pom - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-679_groovy-modules/archetype/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-679_groovy-modules/archetype/src/main/resources/archetype-resources/pom.xml index 4f81a0f7a..e5f0e3c88 100644 --- a/maven-archetype-plugin/src/it/projects/ARCHETYPE-679_groovy-modules/archetype/src/main/resources/archetype-resources/pom.xml +++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-679_groovy-modules/archetype/src/main/resources/archetype-resources/pom.xml @@ -28,4 +28,4 @@ under the License. ${version} pom - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/property-setting-cli/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/property-setting-cli/src/main/resources/archetype-resources/pom.xml index 423aade7b..decb371cb 100644 --- a/maven-archetype-plugin/src/it/projects/property-setting-cli/src/main/resources/archetype-resources/pom.xml +++ b/maven-archetype-plugin/src/it/projects/property-setting-cli/src/main/resources/archetype-resources/pom.xml @@ -31,4 +31,3 @@ under the License. ${foo} - diff --git a/maven-archetype-plugin/src/it/projects/property-setting-cli/src/test/resources/projects/basic/reference/pom.xml b/maven-archetype-plugin/src/it/projects/property-setting-cli/src/test/resources/projects/basic/reference/pom.xml index 62120c439..4ae14faaa 100644 --- a/maven-archetype-plugin/src/it/projects/property-setting-cli/src/test/resources/projects/basic/reference/pom.xml +++ b/maven-archetype-plugin/src/it/projects/property-setting-cli/src/test/resources/projects/basic/reference/pom.xml @@ -31,4 +31,3 @@ under the License. bar - diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/pom.xml index 1c6fcf380..7a35f4802 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/pom.xml @@ -34,4 +34,4 @@ proficio-model proficio-stores - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-api/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-api/pom.xml index abfeb67b1..10a0cd656 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-api/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-api/pom.xml @@ -37,4 +37,4 @@ 1.0-SNAPSHOT - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-cli/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-cli/pom.xml index 27aff0d4d..3ad03b0e3 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-cli/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-cli/pom.xml @@ -47,4 +47,4 @@ 1.0-SNAPSHOT - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-core/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-core/pom.xml index 860bd3eb6..4e09342c6 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-core/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-core/pom.xml @@ -37,4 +37,4 @@ 1.0-SNAPSHOT - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-model/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-model/pom.xml index 64b611bab..3c27f9fec 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-model/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-model/pom.xml @@ -29,4 +29,4 @@ proficio-model proficio model - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/pom.xml index a83d25a38..8e5be6b15 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/pom.xml @@ -35,4 +35,4 @@ proficio-store-memory proficio-store-xstream - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-memory/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-memory/pom.xml index 60e1e0fa4..85439e7a7 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-memory/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-memory/pom.xml @@ -37,4 +37,4 @@ 1.0-SNAPSHOT - \ No newline at end of file + diff --git a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-xstream/pom.xml b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-xstream/pom.xml index 5c6f1460f..582d1f836 100644 --- a/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-xstream/pom.xml +++ b/maven-archetype-plugin/src/it/projects/roundtrip-multi/proficio-stores/proficio-store-xstream/pom.xml @@ -37,4 +37,4 @@ 1.0-SNAPSHOT - \ No newline at end of file + From fcae821fa0a0fdf637089f3759e34773eb92bfc6 Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 6 Dec 2024 18:14:34 +0100 Subject: [PATCH 8/8] [ARCHETYPE-274] Move to mdo version 1.1.0 and include a more detailed description --- .../src/main/mdo/archetype-descriptor.mdo | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo b/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo index 873f15dc1..03e3213b5 100644 --- a/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo +++ b/archetype-models/archetype-descriptor/src/main/mdo/archetype-descriptor.mdo @@ -164,10 +164,13 @@ includeCondition - 1.0.0+ + 1.1.0+ String false - Condition to include the fileset based on a property value. + A string value that should resolve to a boolean value to conditionally include filesets. + This condition should be either a boolean as String or a velocity template language statement that resolves + to a boolean value. If the descriptor contains includeCondition="${shouldInclude}" and the archetype has + a (required) property like shouldInclude=true the fileset is included. directory