Skip to content

Commit a68dd02

Browse files
committed
Update README for new versions
1 parent cb863e1 commit a68dd02

File tree

2 files changed

+39
-52
lines changed

2 files changed

+39
-52
lines changed

README.md

+35-47
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,43 @@ means adding it to the Spring Boot plugin declaration:
3232
</plugin>
3333
```
3434

35-
and in Gradle, you can use the older `apply` style declaration:
35+
and in Gradle, you need to add the `thin-launcher` plugin and (preferably) a `maven-publish` plugin with an explicit publication definition. You can use the newer `id` style declaration:
36+
37+
```groovy
38+
plugins {
39+
id 'org.springframework.boot' version '3.0.1'
40+
id 'io.spring.dependency-management' version '1.1.0'
41+
id 'java'
42+
id 'maven-publish'
43+
id 'org.springframework.boot.experimental.thin-launcher' version '1.0.29.RELEASE'
44+
}
45+
46+
group = 'com.example'
47+
version = '0.0.1-SNAPSHOT'
48+
sourceCompatibility = '17'
49+
50+
repositories {
51+
mavenLocal()
52+
mavenCentral()
53+
maven { url "https://repo.spring.io/snapshot" }
54+
maven { url "https://repo.spring.io/milestone" }
55+
}
56+
57+
publishing {
58+
publications {
59+
maven(MavenPublication) {
60+
from components.java
61+
}
62+
}
63+
}
64+
```
65+
66+
or you can use the older `apply` style declaration:
3667

3768
```groovy
3869
buildscript {
3970
ext {
40-
springBootVersion = '2.2.4.RELEASE'
71+
springBootVersion = '2.7.6'
4172
wrapperVersion = '1.0.29.RELEASE'
4273
}
4374
repositories {
@@ -61,36 +92,7 @@ publishing {
6192
}
6293
```
6394

64-
Or you can use the newer `id` style declaration:
65-
66-
```groovy
67-
plugins {
68-
id 'org.springframework.boot' version '2.2.4.RELEASE'
69-
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
70-
id 'java'
71-
id 'maven-publish'
72-
id 'org.springframework.boot.experimental.thin-launcher' version '1.0.29.RELEASE'
73-
}
74-
75-
group = 'com.example'
76-
version = '0.0.1-SNAPSHOT'
77-
sourceCompatibility = '1.8'
78-
79-
repositories {
80-
mavenLocal()
81-
mavenCentral()
82-
maven { url "https://repo.spring.io/snapshot" }
83-
maven { url "https://repo.spring.io/milestone" }
84-
}
85-
86-
publishing {
87-
publications {
88-
maven(MavenPublication) {
89-
from components.java
90-
}
91-
}
92-
}
93-
```
95+
The publication named "maven" is responsible for creating a `pom.xml` for your application.
9496

9597
For Spring Boot 2.x snapshot versions (or older releases) you also need a `settings.gradle` with the repository configuration for the plugin. e.g. (as generated by https://start.spring.io):
9698

@@ -259,21 +261,7 @@ configuration flag in the plugin (or `-Dthin.compute=false` on the command line)
259261

260262
### Gradle
261263

262-
The same features are available to Gradle users by adding a plugin:
263-
264-
```groovy
265-
buildscript {
266-
...
267-
dependencies {
268-
classpath("org.springframework.boot.experimental:spring-boot-thin-gradle-plugin:${wrapperVersion}")
269-
...
270-
}
271-
}
272-
273-
...
274-
apply plugin: 'org.springframework.boot.experimental.thin-launcher'
275-
276-
```
264+
The same features are available to Gradle users by adding the thin jar plugin (as described above).
277265

278266
The plugin creates 2 tasks for every jar task in the project, one that
279267
reolves the dependencies, and one that copies the jar into the same

gradle-plugin/src/main/java/org/springframework/boot/experimental/gradle/PomTask.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
import java.util.ArrayList;
2121
import java.util.List;
2222

23-
import groovy.util.Node;
24-
25-
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension;
26-
import io.spring.gradle.dependencymanagement.maven.PomDependencyManagementConfigurer;
2723
import org.gradle.api.Action;
2824
import org.gradle.api.DefaultTask;
2925
import org.gradle.api.Project;
@@ -32,14 +28,17 @@
3228
import org.gradle.api.artifacts.repositories.ArtifactRepository;
3329
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
3430
import org.gradle.api.plugins.Convention;
35-
import org.gradle.api.plugins.MavenPluginConvention;
3631
import org.gradle.api.publish.maven.tasks.GenerateMavenPom;
3732
import org.gradle.api.tasks.OutputDirectory;
3833
import org.gradle.api.tasks.TaskAction;
3934
import org.gradle.api.tasks.TaskCollection;
4035
import org.gradle.api.tasks.TaskExecutionException;
4136
import org.springframework.util.ClassUtils;
4237

38+
import groovy.util.Node;
39+
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension;
40+
import io.spring.gradle.dependencymanagement.maven.PomDependencyManagementConfigurer;
41+
4342
/**
4443
* Task to generate a pom file including all runtime dependencies.
4544
*

0 commit comments

Comments
 (0)