Skip to content

Commit fa7bbf3

Browse files
authored
Merge branch 'main' into 585-move-auto-config-registration-to-new-upgrade-report
2 parents 7840ee3 + 90e953e commit fa7bbf3

File tree

114 files changed

+7008
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+7008
-425
lines changed

README.adoc

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
image:https://img.shields.io/github/license/spring-projects-experimental/spring-boot-migrator[GitHub]
55
image:https://img.shields.io/github/v/release/spring-projects-experimental/spring-boot-migrator[GitHub release (latest by date)]
6-
image:https://img.shields.io/github/downloads/spring-projects-experimental/spring-boot-migrator/0.12.0/total[GitHub release (latest by date)]
6+
image:https://img.shields.io/github/downloads/spring-projects-experimental/spring-boot-migrator/0.13.0/total[GitHub release (latest by date)]
7+
image:https://img.shields.io/youtube/channel/views/UC6NuSiwpvI32YTcdIflObPQ?logo=youtube&style=flat-square[YouTube Channel Views]
78

89
image:https://img.shields.io/badge/Join-Slack-green?logo=slack&color=007EC6&style=for-the-badge[link="https://join.slack.com/t/springbootmigrator/shared_invite/zt-1k6yxfi3b-MEQ_MM67qXufWtc~Tw6y9w"]
910
image:https://img.shields.io/github/discussions/spring-projects-experimental/spring-boot-migrator?label=GitHub%20discussions&logo=GitHUb&style=for-the-badge[GitHub Discussions]
10-
image:https://img.shields.io/gitter/room/spring-boot-migrator/community?color=007EC6&logo=gitter&style=for-the-badge[Gitter]
11+
image:https://img.shields.io/gitter/room/spring-boot-migrator/community?color=007EC6&logo=gitter&style=for-the-badge[link="https://gitter.im/spring-boot-migrator/community"]
1112

1213
[quote]
1314
____
@@ -24,32 +25,55 @@ ____
2425

2526

2627
== Spring Boot 3.0 Upgrades
27-
2828
We are working on automated upgrade from Spring Boot 2.7 to Spring Boot 3.0.
2929

30+
Click the image to watch a demo video [2:26]
31+
32+
ifdef::env-github[]
33+
image:https://img.youtube.com/vi/RKXblzn8lFg/maxresdefault.jpg[link=https://www.youtube.com/embed/RKXblzn8lFg]
34+
endif::[]
35+
36+
=== Try the Spring Boot Upgrade tool
37+
. Download the https://github.com/spring-projects-experimental/spring-boot-migrator/releases/download/latest/spring-boot-upgrade.jar[spring-boot-upgrade.jar]
38+
. Run `java -jar --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED spring-boot-upgrade.jar <path-to-application>`
39+
3040
If any of your applications is on 2.7 and uses Maven (Gradle is currently not supported), we'd be happy if you
3141
could give SBM a try and provide feedback of how it worked out.
3242
It is very hard to come up with all the possible setups found in the wild and therefor we need you - the community - to provide feedback to stabilize the recipe.
3343

3444
Thank you!
3545

36-
Download the https://github.com/spring-projects-experimental/spring-boot-migrator/releases[latest release]
37-
38-
- Start SBM: `java -jar spring-boot-migrator.jar`
39-
- Scan your application: `scan <path to application>`
40-
- generate a report first: `apply boot-2.7-3.0-upgrade-report`
41-
- Run the migration: `apply boot-2.7-3.0-dependency-version-update`
42-
4346
=== Contributing
44-
4547
Any contribution is appreciated!
46-
If you want to get involved, please have a look at https://github.com/spring-projects-experimental/spring-boot-migrator/discussions/446[this discussion] where we provide additional information related to the Spring Boot 3 Upgrade.
48+
If you want to get involved, please have a look at https://github.com/spring-projects-experimental/spring-boot-migrator/wiki/Spring-Boot-3-Upgrade-Report-Contribution-Guideline[Spring Boot 3 Upgrade Report Contribution Guideline] where we provide information related to contributing to the Spring Boot 3 Upgrade.
4749
Please don't hesitate to ask questions and provide feedback.
4850

51+
Find the list of Spring Boot 3 Upgrade related issues labeled as `good first issue` https://github.com/spring-projects-experimental/spring-boot-migrator/issues?q=is%3Aissue+is%3Aopen+label%3A3.0.0+label%3A%22good+first+issue%22+[here]
52+
4953
If you decided you want to work on an issue, leave a comment letting us know that you want to work on it and we go from there.
5054

5155
Thank you!
5256

57+
== JEE to Spring Boot Migration
58+
Spring Boot Migrator offers recipes to migrate JEE applications to Spring Boot.
59+
60+
These specifications are covered (to some extent and varying completeness)
61+
62+
* Servlet
63+
* JAX-RS
64+
* SOAP
65+
* JMS
66+
* EJB
67+
* JPA
68+
* ejb-jar.xml
69+
* weblogic-ejb-jar.xml
70+
71+
Click the image to watch a demo video [16:57]
72+
73+
ifdef::env-github[]
74+
image:https://img.youtube.com/vi/PnvsLafekWE/maxresdefault.jpg[link=https://www.youtube.com/embed/PnvsLafekWE]
75+
endif::[]
76+
5377
== How SBM works
5478

5579
Spring Boot Migrator uses and is compatible with https://github.com/openrewrite/rewrite[OpenRewrite,window=_blank],
@@ -74,7 +98,7 @@ image::images/apply.png[]
7498

7599
== Getting started
76100

77-
* Download the latest release from here: https://github.com/spring-projects-experimental/spring-boot-migrator/releases[Spring Boot Migrator Releases]
101+
* Download the latest release from here: https://github.com/spring-projects-experimental/spring-boot-migrator/releases/latest[Spring Boot Migrator Releases]
78102
* Start the application: `java -jar spring-boot-migrator.jar`
79103
* In the CLI start by scanning the application `scan <path-to-application>`
80104
* From the list of applicable recipes select the one you want to apply, +

components/openrewrite-spring-recipes/src/main/java/org/springframework/sbm/MigrateBoot23To24Recipe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package org.springframework.sbm;
1717

1818
import org.springframework.sbm.engine.recipe.UserInteractions;
19-
import org.springframework.sbm.build.migration.conditions.AnyDependencyExistMatchingRegex;
19+
import org.springframework.sbm.build.migration.conditions.AnyDeclaredDependencyExistMatchingRegex;
2020
import org.springframework.sbm.engine.recipe.Action;
2121
import org.springframework.sbm.engine.recipe.Recipe;
2222
import org.springframework.sbm.spring.migration.actions.InitDataSourceAfterJpaInitAction;
@@ -40,7 +40,7 @@ private Recipe createSpringBootUpgradeRecipe(String fromVersion, String toVersio
4040
return Recipe.builder()
4141
.name("migrate-boot-" + fromVersion + "-" + toVersion)
4242
.description("Migrate from Spring Boot " + fromVersion + " to " + toVersion)
43-
.condition(AnyDependencyExistMatchingRegex.builder()
43+
.condition(AnyDeclaredDependencyExistMatchingRegex.builder()
4444
.dependencies(List.of("org\\.springframework\\.boot:.*:" + fromVersion.replace(".", "\\.") + ".*"))
4545
.build()
4646
)

components/openrewrite-spring-recipes/src/main/java/org/springframework/sbm/OrRecipesConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.springframework.context.annotation.Bean;
2020
import org.springframework.context.annotation.Configuration;
2121
import org.springframework.sbm.build.impl.OpenRewriteMavenBuildFile;
22-
import org.springframework.sbm.build.migration.conditions.AnyDependencyExistMatchingRegex;
22+
import org.springframework.sbm.build.migration.conditions.AnyDeclaredDependencyExistMatchingRegex;
2323
import org.springframework.sbm.build.migration.recipe.RemoveMavenPlugin;
2424
import org.springframework.sbm.engine.recipe.Action;
2525
import org.springframework.sbm.engine.recipe.Condition;
@@ -71,7 +71,7 @@ Recipe recipeSpringBoot1To2Migration(RewriteRecipesRepository repo) {
7171
r.doNext(new AddPluginDependency("ro.isdc.wro4j", "wro4j-maven-plugin", "org.mockito", "mockito-core", "${mockito.version}"));
7272
r.doNext(new OpenRewriteMavenBuildFile.RefreshPomModel());
7373

74-
AnyDependencyExistMatchingRegex condition = new AnyDependencyExistMatchingRegex();
74+
AnyDeclaredDependencyExistMatchingRegex condition = new AnyDeclaredDependencyExistMatchingRegex();
7575
condition.setDependencies(List.of("org\\.springframework\\.boot:.*:1\\..*"));
7676

7777
return createRecipe("upgrade-boot-1x-to-2x", r, condition);

components/sbm-core/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@
154154
<classifier>tests</classifier>
155155
<scope>test</scope>
156156
</dependency>
157-
</dependencies>
157+
<dependency>
158+
<groupId>com.fasterxml.jackson.dataformat</groupId>
159+
<artifactId>jackson-dataformat-xml</artifactId>
160+
<version>2.14.1</version>
161+
</dependency>
162+
163+
</dependencies>
158164
<build>
159165
<plugins>
160166
<plugin>

components/sbm-core/src/main/java/org/springframework/sbm/build/api/BuildFile.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
package org.springframework.sbm.build.api;
1717

1818
import org.openrewrite.maven.tree.Scope;
19+
1920
import org.springframework.sbm.project.resource.ProjectResource;
2021

2122
import java.nio.file.Path;
2223
import java.util.List;
24+
import java.util.Map;
2325
import java.util.Optional;
2426
import java.util.Set;
2527

@@ -47,18 +49,18 @@ public interface BuildFile extends ProjectResource {
4749
Set<Dependency> getEffectiveDependencies();
4850

4951
/**
50-
* Check if any declared dependency matches any of the given regex.
52+
* Check if any dependency declared in this build file matches any of the given regex.
5153
*
5254
* @param dependencyPatterns the patterns matching against Maven coordinates 'groupId:artifactId:version'
5355
*/
5456
boolean hasDeclaredDependencyMatchingRegex(String... dependencyPatterns);
5557

5658
/**
57-
* Check if any dependency (declared or transitive) matches any of the given regex.
59+
* Check if any dependency declared or transitive in any scope in this build file matches any of the given regex.
5860
*
5961
* @param dependencyPatterns the patterns matching against Maven coordinates 'groupId:artifactId:version'
6062
*/
61-
// boolean hasDependencyMatchingRegex(String... dependencyPatterns);
63+
boolean hasEffectiveDependencyMatchingRegex(String... dependencyPatterns);
6264

6365
boolean hasExactDeclaredDependency(Dependency dependency);
6466

@@ -117,6 +119,8 @@ public interface BuildFile extends ProjectResource {
117119

118120
String getProperty(String key);
119121

122+
void deleteProperty(String key);
123+
120124
String print();
121125

122126
/**
@@ -165,4 +169,7 @@ public interface BuildFile extends ProjectResource {
165169
List<RepositoryDefinition> getPluginRepositories();
166170

167171
List<String> getDeclaredModules();
172+
173+
Optional<Plugin> findPlugin(String groupId, String artifactId);
174+
168175
}

components/sbm-core/src/main/java/org/springframework/sbm/build/api/Plugin.java

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,46 @@
1515
*/
1616
package org.springframework.sbm.build.api;
1717

18-
import lombok.*;
19-
20-
import javax.validation.constraints.NotNull;
21-
import javax.validation.constraints.Null;
2218
import java.util.List;
19+
import java.util.Optional;
20+
import java.util.Set;
21+
22+
public interface Plugin {
23+
24+
String getGroupId();
25+
26+
String getArtifactId();
27+
28+
String getVersion();
29+
30+
String getDependencies();
31+
32+
List<? extends Execution> getExecutions();
33+
34+
Configuration getConfiguration();
35+
36+
interface Configuration {
37+
38+
Optional<String> getDeclaredStringValue(String property);
39+
40+
String getResolvedStringValue(String property);
41+
42+
void setDeclaredStringValue(String property, String value);
43+
44+
Set<String> getPropertyKeys();
45+
46+
}
47+
48+
interface Execution {
49+
50+
String getId();
51+
52+
List<String> getGoals();
53+
54+
String getPhase();
55+
56+
String getConfiguration();
57+
58+
}
2359

24-
@Getter
25-
@Setter
26-
@Builder
27-
@NoArgsConstructor
28-
@AllArgsConstructor
29-
public class Plugin {
30-
31-
@NotNull
32-
private String groupId;
33-
34-
@NotNull
35-
private String artifactId;
36-
37-
private String version;
38-
39-
@Singular("execution")
40-
private List<Execution> executions;
41-
42-
private String configuration;
43-
44-
private String dependencies;
45-
46-
@Builder
47-
@Getter
48-
@NoArgsConstructor
49-
@AllArgsConstructor
50-
@Setter
51-
public static class Execution {
52-
@Null
53-
private String id;
54-
@Singular("goal")
55-
private List<String> goals;
56-
@Null
57-
private String phase;
58-
@Null
59-
private String configuration;
60-
}
61-
}
60+
}

components/sbm-core/src/main/java/org/springframework/sbm/build/impl/Refactoring.java renamed to components/sbm-core/src/main/java/org/springframework/sbm/build/impl/MavenBuildFileRefactoring.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323
import org.openrewrite.xml.tree.Xml;
2424
import org.springframework.sbm.project.resource.RewriteSourceFileHolder;
2525
import org.springframework.sbm.support.openrewrite.GenericOpenRewriteRecipe;
26-
import org.springframework.util.ReflectionUtils;
2726

2827
import java.util.Arrays;
2928
import java.util.List;
3029
import java.util.stream.Collectors;
3130

3231
@RequiredArgsConstructor
33-
class Refactoring<P> {
32+
class MavenBuildFileRefactoring<P> {
3433

3534
private final RewriteSourceFileHolder<Xml.Document> pom;
3635

@@ -57,7 +56,9 @@ private List<Result> executeRecipe(Recipe recipe) {
5756

5857
private void processResults(List<Result> results) {
5958
if (!results.isEmpty()) {
60-
results.forEach(c -> processResult(c));
59+
// FIXME: Works only on a single POM and does not apply to all other resources
60+
pom.replaceWith((Xml.Document) results.get(0).getAfter());
61+
// results.forEach(c -> processResult(c));
6162
}
6263
}
6364

0 commit comments

Comments
 (0)