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 - - - -