From d2e34e6b07ce0c5d09a0d870beb01a9226e4d654 Mon Sep 17 00:00:00 2001 From: Marc Rohlfs Date: Thu, 20 Jun 2019 13:45:59 +0200 Subject: [PATCH 1/2] Make layout parameter available as a user property This commit allows the layout parameter of the Maven repackage goal to be set from the command line. See gh-17277 --- .../invoker.properties | 1 + .../src/it/repackage-layout-default/pom.xml | 30 +++++++++++++++++++ .../main/java/org/test/SampleApplication.java | 23 ++++++++++++++ .../it/repackage-layout-default/verify.groovy | 4 +++ .../invoker.properties | 1 + .../src/it/repackage-layout-property/pom.xml | 30 +++++++++++++++++++ .../main/java/org/test/SampleApplication.java | 23 ++++++++++++++ .../repackage-layout-property/verify.groovy | 4 +++ .../boot/maven/RepackageMojo.java | 2 +- 9 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/pom.xml create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/src/main/java/org/test/SampleApplication.java create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/invoker.properties create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/verify.groovy diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties new file mode 100644 index 0000000000..f6e40a283d --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties @@ -0,0 +1 @@ +invoker.goals=package \ No newline at end of file diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/pom.xml new file mode 100644 index 0000000000..3e48e4f979 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + org.springframework.boot.maven.it + repackage-layout-default + 0.0.1.BUILD-SNAPSHOT + + UTF-8 + @java.version@ + @java.version@ + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + package + + repackage + + + + + + + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/src/main/java/org/test/SampleApplication.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/src/main/java/org/test/SampleApplication.java new file mode 100644 index 0000000000..7ff035e400 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/src/main/java/org/test/SampleApplication.java @@ -0,0 +1,23 @@ +/* + * Copyright 2012-2017 the original author or authors. + * + * Licensed 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 + * + * https://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. + */ + +package org.test; + +public class SampleApplication { + + public static void main(String[] args) { + } +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy new file mode 100644 index 0000000000..7c6bfa8c61 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy @@ -0,0 +1,4 @@ +import static org.junit.Assert.assertFalse + +def file = new File(basedir, "build.log") +assertFalse file.text.contains("Layout:") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/invoker.properties b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/invoker.properties new file mode 100644 index 0000000000..034be12754 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/invoker.properties @@ -0,0 +1 @@ +invoker.goals=package -Dspring-boot.repackage.layout=ZIP \ No newline at end of file diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml new file mode 100644 index 0000000000..3e48e4f979 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + org.springframework.boot.maven.it + repackage-layout-default + 0.0.1.BUILD-SNAPSHOT + + UTF-8 + @java.version@ + @java.version@ + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + package + + repackage + + + + + + + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java new file mode 100644 index 0000000000..7ff035e400 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java @@ -0,0 +1,23 @@ +/* + * Copyright 2012-2017 the original author or authors. + * + * Licensed 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 + * + * https://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. + */ + +package org.test; + +public class SampleApplication { + + public static void main(String[] args) { + } +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/verify.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/verify.groovy new file mode 100644 index 0000000000..74a5ff22db --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/verify.groovy @@ -0,0 +1,4 @@ +import static org.junit.Assert.assertTrue + +def file = new File(basedir, "build.log") +assertTrue file.text.contains("Layout: ZIP") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index 3ce4eff58f..d57f51d3db 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -139,7 +139,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { * archive type. * @since 1.0.0 */ - @Parameter + @Parameter(property = "spring-boot.repackage.layout") private LayoutType layout; /** From 4ce9c6edb3816b1398cd3c0ac41b66b806f62ecf Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 18 Jul 2019 18:15:40 +0200 Subject: [PATCH 2/2] Polish "Make layout parameter available as a user property" See gh-17277 --- .../invoker.properties | 0 .../pom.xml | 2 +- .../main/java/org/test/SampleApplication.java | 0 .../verify.groovy | 0 .../src/it/jar/verify.groovy | 1 + .../invoker.properties | 1 - .../it/repackage-layout-default/verify.groovy | 4 --- .../src/it/repackage-layout-property/pom.xml | 30 ------------------- .../main/java/org/test/SampleApplication.java | 23 -------------- 9 files changed, 2 insertions(+), 59 deletions(-) rename spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/{repackage-layout-property => jar-with-layout-property}/invoker.properties (100%) rename spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/{repackage-layout-default => jar-with-layout-property}/pom.xml (95%) rename spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/{repackage-layout-default => jar-with-layout-property}/src/main/java/org/test/SampleApplication.java (100%) rename spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/{repackage-layout-property => jar-with-layout-property}/verify.groovy (100%) delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/invoker.properties b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/invoker.properties similarity index 100% rename from spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/invoker.properties rename to spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/invoker.properties diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/pom.xml similarity index 95% rename from spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/pom.xml rename to spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/pom.xml index 3e48e4f979..5df67b8b85 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/pom.xml +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot.maven.it - repackage-layout-default + jar-with-layout-property 0.0.1.BUILD-SNAPSHOT UTF-8 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/src/main/java/org/test/SampleApplication.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/src/main/java/org/test/SampleApplication.java similarity index 100% rename from spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/src/main/java/org/test/SampleApplication.java rename to spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/src/main/java/org/test/SampleApplication.java diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/verify.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/verify.groovy similarity index 100% rename from spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/verify.groovy rename to spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-with-layout-property/verify.groovy diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar/verify.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar/verify.groovy index ee90453e49..248bf1acf3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar/verify.groovy +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/jar/verify.groovy @@ -15,4 +15,5 @@ assertTrue 'main artifact should have been installed', file.text.contains ("Installing " + main + " to") assertFalse 'backup artifact should not have been installed', file.text.contains ("Installing " + backup + "to") +assertFalse file.text.contains("Layout:") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties deleted file mode 100644 index f6e40a283d..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/invoker.properties +++ /dev/null @@ -1 +0,0 @@ -invoker.goals=package \ No newline at end of file diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy deleted file mode 100644 index 7c6bfa8c61..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-default/verify.groovy +++ /dev/null @@ -1,4 +0,0 @@ -import static org.junit.Assert.assertFalse - -def file = new File(basedir, "build.log") -assertFalse file.text.contains("Layout:") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml deleted file mode 100644 index 3e48e4f979..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - org.springframework.boot.maven.it - repackage-layout-default - 0.0.1.BUILD-SNAPSHOT - - UTF-8 - @java.version@ - @java.version@ - - - - - @project.groupId@ - @project.artifactId@ - @project.version@ - - - package - - repackage - - - - - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java deleted file mode 100644 index 7ff035e400..0000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/it/repackage-layout-property/src/main/java/org/test/SampleApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed 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 - * - * https://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. - */ - -package org.test; - -public class SampleApplication { - - public static void main(String[] args) { - } -}