diff --git a/gradle.properties b/gradle.properties index 1416f8a62..6b2180cf8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ POM_DESCRIPTION=Gradle plugin to create fat/uber JARs, apply file transforms, an POM_INCEPTION_YEAR=2024 POM_URL=https://github.com/GradleUp/shadow -POM_LICENSE_NAME=The Apache Software License, Version 2.0 +POM_LICENSE_NAME=Apache-2.0 POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENSE_DIST=repo @@ -27,4 +27,4 @@ POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/GradleUp/shadow.git POM_DEVELOPER_ID=gradleup POM_DEVELOPER_NAME=GradleUp developers -POM_DEVELOPER_URL=https://github.com/GradleUp \ No newline at end of file +POM_DEVELOPER_URL=https://github.com/GradleUp diff --git a/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy b/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy index 7cec61db8..6099b7dd4 100644 --- a/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy +++ b/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPluginSpec.groovy @@ -1217,6 +1217,41 @@ class ShadowPluginSpec extends PluginSpecification { assert result.output.contains('TestApp: Hello World! (foo)') } + @Issue("https://github.com/GradleUp/shadow/pull/459") + def 'exclude gradleApi() by default'() { + given: + buildFile.text = getDefaultBuildScript('java-gradle-plugin') + buildFile << """ + dependencies { + compileOnly gradleApi() + } + """.stripIndent() + + file('src/main/java/my/plugin/MyPlugin.java') << """ + package my.plugin; + import org.gradle.api.Plugin; + import org.gradle.api.Project; + public class MyPlugin implements Plugin { + public void apply(Project project) { + System.out.println("MyPlugin: Hello World!"); + } + } + """.stripIndent() + file('src/main/resources/META-INF/gradle-plugins/my.plugin.properties') << """ + implementation-class=my.plugin.MyPlugin + """.stripIndent() + + when: + run('shadowJar') + + then: + assert output.exists() + + and: + JarFile jar = new JarFile(output) + assert jar.entries().collect().findAll { it.name.endsWith('.class') }.size() == 1 + } + private String escapedPath(File file) { file.path.replaceAll('\\\\', '\\\\\\\\') }