From ccfcad16d90351c676d6548093ab5cb7a66f5dd5 Mon Sep 17 00:00:00 2001 From: Remko Popma Date: Sat, 26 Feb 2022 10:10:11 +0900 Subject: [PATCH] [#1608] Make `picocli-spring-boot-starter` a named JPMS module with a `module-info.class` Closes #1608 --- RELEASE-NOTES.md | 1 + picocli-spring-boot-starter/build.gradle | 6 ++- .../src/main/java9/module-info.java | 41 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 picocli-spring-boot-starter/src/main/java9/module-info.java diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 63a692bf2..255231901 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -78,6 +78,7 @@ Picocli 4.7.0 introduced a `sortSynopsis = false` attribute to let the synopsis * [#1611] API: The `picocli-groovy` artifact is now a named JPMS module with a `module-info.class`. * [#1610] API: The `picocli-shell-jline2` is now a named JPMS module with a `module-info.class`. * [#1609] API: The `picocli-shell-jline3` is now a named JPMS module with a `module-info.class`. +* [#1608] API: The `picocli-spring-boot-starter` is now a named JPMS module with a `module-info.class`. NOTE: its module name changed to `info.picocli.spring.boot` from `info.picocli.spring`. * [#1600] API: Add `requires static java.sql` to picocli `module-info`. * [#1471] API: Provide a programmatic way to configure Picocli's `TraceLevel`. Thanks to [ekinano](https://github.com/ekinano) for raising this. * [#1125] API: Add parser configuration to allow options to consume values that match subcommand names or option names. diff --git a/picocli-spring-boot-starter/build.gradle b/picocli-spring-boot-starter/build.gradle index 2288de010..54f607f06 100644 --- a/picocli-spring-boot-starter/build.gradle +++ b/picocli-spring-boot-starter/build.gradle @@ -5,6 +5,8 @@ plugins { group 'info.picocli' description 'Picocli Spring Boot Starter - Enables Spring Dependency Injection and Spring Boot AutoConfiguration in Picocli Commands.' version "$projectVersion" +ext.moduleName = 'info.picocli.spring.boot' + sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -22,8 +24,8 @@ jar { 'Specification-Version' : archiveVersion.get(), 'Implementation-Title' : 'Picocli Spring Boot Starter', 'Implementation-Vendor' : 'Remko Popma', - 'Implementation-Version': archiveVersion.get(), - 'Automatic-Module-Name' : 'info.picocli.spring' + 'Implementation-Version': archiveVersion.get() +// 'Automatic-Module-Name' : 'info.picocli.spring' } } diff --git a/picocli-spring-boot-starter/src/main/java9/module-info.java b/picocli-spring-boot-starter/src/main/java9/module-info.java new file mode 100644 index 000000000..27452c1f1 --- /dev/null +++ b/picocli-spring-boot-starter/src/main/java9/module-info.java @@ -0,0 +1,41 @@ +/* + Copyright 2017 Remko Popma + + 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 + + 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. +*/ + +// When compiling in Gradle, the org.beryx.jar plugin will be able to +// compile this file even with Java versions 8 or older. + +// Your IDE may complain that "Modules are not supported at language level '5'", +// and javac may give an error: "java: class, interface or enum expected". +// To resolve this, exclude the 'java9' folder from the sources. +// IntelliJ IDEA: +// File > Project Structure... > Modules > picocli_main > Sources: +// select the 'java9' folder and click 'Mark as: Excluded'. + +/** + * Defines Spring-based implementations of picocli APIs and picocli-based implementations + * of Spring APIs for integrating picocli with Spring Boot and Spring Boot AutoConfiguration. + * + * @since 4.7.0 + */ +module info.picocli.spring.boot { + requires info.picocli; + requires java.logging; + requires spring.boot; + requires spring.boot.autoconfigure; + + exports picocli.spring; + exports picocli.spring.boot.autoconfigure; +}