From 7940d17a09c6f053c4e4957e95d628f62b37c212 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Tue, 6 Jun 2023 11:36:42 +0200 Subject: [PATCH] Update java,maven,junit,spring and other dependecies --- pom.xml | 11 +- .../pom.xml | 18 +-- .../pom.xml | 11 +- .../SpringCloudStreamAppGeneratorMojo.java | 138 ++++++++++-------- .../pom.xml | 38 ++--- 5 files changed, 119 insertions(+), 97 deletions(-) diff --git a/pom.xml b/pom.xml index a4a0084..a57920f 100644 --- a/pom.xml +++ b/pom.xml @@ -10,15 +10,14 @@ 17 - 3.1.1 - 3.2.1 - 2.22.2 + 3.5.0 + 3.3.0 + 3.1.0 UTF-8 UTF-8 ${java.version} ${java.version} - 3.0.1 - 3.1.0 + 3.3.0 false true true @@ -99,7 +98,7 @@ - 1.8 + 17 true diff --git a/spring-cloud-dataflow-apps-docs-plugin/pom.xml b/spring-cloud-dataflow-apps-docs-plugin/pom.xml index b01b48f..3685f30 100644 --- a/spring-cloud-dataflow-apps-docs-plugin/pom.xml +++ b/spring-cloud-dataflow-apps-docs-plugin/pom.xml @@ -16,36 +16,36 @@ org.apache.maven maven-plugin-api - 3.5.2 + 3.9.2 org.apache.maven maven-core - 3.5.2 + 3.9.2 org.springframework.cloud spring-cloud-dataflow-configuration-metadata - 2.7.0 + 2.10.3 org.apache.maven.plugin-tools maven-plugin-annotations - 3.4 + 3.9.0 provided junit junit - 4.12 + 4.13.2 test org.assertj assertj-core - 3.15.0 + 3.24.2 test @@ -55,14 +55,14 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5 + 3.9.0 org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + 17 + 17 diff --git a/spring-cloud-dataflow-apps-generator-plugin/pom.xml b/spring-cloud-dataflow-apps-generator-plugin/pom.xml index 9c0b289..afd2bf2 100644 --- a/spring-cloud-dataflow-apps-generator-plugin/pom.xml +++ b/spring-cloud-dataflow-apps-generator-plugin/pom.xml @@ -64,13 +64,14 @@ junit junit - 4.13 + 4.13.2 test org.apache.maven.plugin-testing maven-plugin-testing-harness 3.3.0 + test @@ -82,7 +83,7 @@ org.assertj assertj-core - 3.15.0 + 3.24.2 test @@ -116,8 +117,8 @@ org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + 17 + 17 @@ -131,7 +132,7 @@ org.apache.maven.plugins maven-invoker-plugin - 3.2.1 + 3.5.1 true ${project.build.directory}/it diff --git a/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java b/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java index ecd80e2..2eb7563 100644 --- a/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java +++ b/spring-cloud-dataflow-apps-generator-plugin/src/main/java/org/springframework/cloud/dataflow/app/plugin/SpringCloudStreamAppGeneratorMojo.java @@ -80,63 +80,76 @@ public class SpringCloudStreamAppGeneratorMojo extends AbstractMojo { @Parameter private Map binders = new HashMap<>(); + private static boolean isEmpty(String text) { + return !StringUtils.hasText(text); + } + @Override public void execute() throws MojoFailureException, MojoExecutionException { // ---------------------------------------------------------------------------------------------------------- - // Application Configuration + // Application Configuration // ---------------------------------------------------------------------------------------------------------- AppDefinition app = new AppDefinition(); - String bootVersion = StringUtils.isEmpty(this.application.getBootVersion()) ? - this.global.getApplication().getBootVersion() : this.application.getBootVersion(); - if (StringUtils.isEmpty(bootVersion)) { + String bootVersion = isEmpty(this.application.getBootVersion()) ? this.global.getApplication().getBootVersion() + : this.application.getBootVersion(); + if (isEmpty(bootVersion)) { throw new MojoExecutionException("The application.bootVersion parameter is required!"); } app.setSpringBootVersion(bootVersion); - String applicationName = StringUtils.isEmpty(this.application.getName()) ? - this.global.getApplication().getName() : this.application.getName(); - if (StringUtils.isEmpty(applicationName)) { + String applicationName = isEmpty(this.application.getName()) ? this.global.getApplication().getName() + : this.application.getName(); + if (isEmpty(applicationName)) { throw new MojoExecutionException("The application.name parameter is required!"); } app.setName(applicationName); - AppDefinition.AppType applicationType = (this.application.getType() == null) ? - this.global.getApplication().getType() : this.application.getType(); + AppDefinition.AppType applicationType = (this.application.getType() == null) + ? this.global.getApplication().getType() + : this.application.getType(); if (applicationType == null) { throw new MojoExecutionException("The application.type parameter is required!"); } app.setType(applicationType); - String applicationVersion = StringUtils.isEmpty(this.application.getVersion()) ? - this.global.getApplication().getVersion() : this.application.getVersion(); - if (StringUtils.isEmpty(applicationVersion)) { + String applicationVersion = isEmpty(this.application.getVersion()) ? this.global.getApplication().getVersion() + : this.application.getVersion(); + if (isEmpty(applicationVersion)) { throw new MojoExecutionException("The application.version parameter is required!"); } app.setVersion(applicationVersion); - String applicationConfigClass = StringUtils.isEmpty(this.application.getConfigClass()) ? - this.global.getApplication().getConfigClass() : this.application.getConfigClass(); - app.setConfigClass(applicationConfigClass); // TODO is applicationConfigClass a required parameter? + String applicationConfigClass = isEmpty(this.application.getConfigClass()) + ? this.global.getApplication().getConfigClass() + : this.application.getConfigClass(); + if (isEmpty(applicationConfigClass)) { + throw new MojoExecutionException("The application.configClass parameter is required!"); + } + app.setConfigClass(applicationConfigClass); - String applicationGroupId = StringUtils.isEmpty(this.application.getGroupId()) ? - this.global.getApplication().getGroupId() : this.application.getGroupId(); + String applicationGroupId = isEmpty(this.application.getGroupId()) + ? this.global.getApplication().getGroupId() + : this.application.getGroupId(); app.setGroupId(applicationGroupId); // optional parameter - String applicationFunctionDefinition = StringUtils.isEmpty(this.application.getFunctionDefinition()) ? - this.global.getApplication().getFunctionDefinition() : this.application.getFunctionDefinition(); - app.setFunctionDefinition(applicationFunctionDefinition); //TODO is applicationFunctionDefinition required? + String applicationFunctionDefinition = isEmpty(this.application.getFunctionDefinition()) + ? this.global.getApplication().getFunctionDefinition() + : this.application.getFunctionDefinition(); + app.setFunctionDefinition(applicationFunctionDefinition); // TODO is applicationFunctionDefinition required? - String metadataMavenPluginVersion = StringUtils.isEmpty(this.application.getMetadata().getMavenPluginVersion()) ? - this.global.getApplication().getMetadata().getMavenPluginVersion() : this.application.getMetadata().getMavenPluginVersion(); - if (StringUtils.isEmpty(metadataMavenPluginVersion)) { + String metadataMavenPluginVersion = isEmpty(this.application.getMetadata().getMavenPluginVersion()) + ? this.global.getApplication().getMetadata().getMavenPluginVersion() + : this.application.getMetadata().getMavenPluginVersion(); + if (isEmpty(metadataMavenPluginVersion)) { throw new MojoExecutionException("The application.metadata.mavenPluginVersion parameter is required!"); } app.getMetadata().setMavenPluginVersion(metadataMavenPluginVersion); - List allSourceTypeFilters = new ArrayList<>(this.global.getApplication().getMetadata().getSourceTypeFilters()); + List allSourceTypeFilters = new ArrayList<>( + this.global.getApplication().getMetadata().getSourceTypeFilters()); allSourceTypeFilters.addAll(this.application.getMetadata().getSourceTypeFilters()); List allNamedFilters = new ArrayList<>(this.global.getApplication().getMetadata().getNameFilters()); allNamedFilters.addAll(this.application.getMetadata().getNameFilters()); @@ -155,19 +168,20 @@ public void execute() throws MojoFailureException, MojoExecutionException { Map allApplicationProperties = new TreeMap<>(this.global.getApplication().getProperties()); allApplicationProperties.putAll(this.application.getProperties()); app.setProperties(allApplicationProperties.entrySet().stream() - .map(e -> e.getKey() + "=" + (StringUtils.hasText(e.getValue()) ? - e.getValue().replaceAll("^\"|\"$", "") : "")) + .map(e -> e.getKey() + "=" + + (StringUtils.hasText(e.getValue()) ? e.getValue().replaceAll("^\"|\"$", "") : "")) .collect(Collectors.toList())); // Maven properties Map allMavenProperties = new TreeMap<>(this.global.getApplication().getMaven().getProperties()); allMavenProperties.putAll(this.application.getMaven().getProperties()); app.getMaven().setProperties(allMavenProperties.entrySet().stream() - .map(es -> "<" + es.getKey() + ">" + (StringUtils.hasText(es.getValue()) ? - es.getValue().replaceAll("^\"|\"$", "") : "") + "") + .map(es -> "<" + es.getKey() + ">" + + (StringUtils.hasText(es.getValue()) ? es.getValue().replaceAll("^\"|\"$", "") : "") + "") .collect(Collectors.toList())); - //Maven BOM. For DependencyManagement it is important to retain the exact definition order! + // Maven BOM. For DependencyManagement it is important to retain the exact definition order! // Override the global dependencies with matching app dependency definitions. Retain the definition order! List allDeps = this.global.getApplication().getMaven().getDependencyManagement().stream() .map(globalDep -> this.application.getMaven().getDependencyManagement().stream() @@ -193,10 +207,11 @@ public void execute() throws MojoFailureException, MojoExecutionException { .map(xml -> MavenXmlWriter.indent(xml, 12)) .collect(Collectors.toList())); - //Maven Dependencies + // Maven Dependencies Map allDependenciesMap = this.global.getApplication().getMaven().getDependencies().stream() .collect(Collectors.toMap(d -> d.getGroupId() + ":" + d.getArtifactId(), d -> d)); - // Ensure that for dependencies with same maven coordinates that application definition overrides the global one. + // Ensure that for dependencies with same maven coordinates that application definition overrides the global + // one. allDependenciesMap.putAll(this.application.getMaven().getDependencies().stream() .collect(Collectors.toMap(d -> d.getGroupId() + ":" + d.getArtifactId(), d -> d))); app.getMaven().setDependencies(allDependenciesMap.values().stream() @@ -204,7 +219,7 @@ public void execute() throws MojoFailureException, MojoExecutionException { .map(xml -> MavenXmlWriter.indent(xml, 8)) .collect(Collectors.toList())); - //Maven Plugins + // Maven Plugins Map allPluginsMap = this.global.getApplication().getMaven().getPlugins().stream() .collect(Collectors.toMap(p -> p.getGroupId() + ":" + p.getArtifactId(), p -> p)); // Ensure that for plugins with same maven coordinates that application definition overrides the global one. @@ -227,9 +242,11 @@ public void execute() throws MojoFailureException, MojoExecutionException { .collect(Collectors.toList())); // Container Image configuration - AppDefinition.ContainerImageFormat containerImageFormat = (this.application.getContainerImage().getFormat() != null) ? - this.application.getContainerImage().getFormat() : this.global.getApplication().getContainerImage().getFormat(); - containerImageFormat = (containerImageFormat == null) ? AppDefinition.ContainerImageFormat.Docker : containerImageFormat; + AppDefinition.ContainerImageFormat containerImageFormat = (this.application.getContainerImage() + .getFormat() != null) ? this.application.getContainerImage().getFormat() + : this.global.getApplication().getContainerImage().getFormat(); + containerImageFormat = (containerImageFormat == null) ? AppDefinition.ContainerImageFormat.Docker + : containerImageFormat; app.getContainerImage().setFormat(containerImageFormat); // TODO how to choose between global an app metadata enabling? @@ -255,7 +272,7 @@ else if (StringUtils.hasText(this.global.getApplication().getContainerImage().ge ProjectGeneratorProperties generatorProperties = new ProjectGeneratorProperties(); // ---------------------------------------------------------------------------------------------------------- - // Binders Configuration + // Binders Configuration // ---------------------------------------------------------------------------------------------------------- Map allBinders = new HashMap<>(this.global.getBinders()); @@ -309,7 +326,7 @@ else if (StringUtils.hasText(this.global.getApplication().getContainerImage().ge app.setBootPluginConfiguration(this.application.getBootPluginConfiguration()); // ---------------------------------------------------------------------------------------------------------- - // Project Generator + // Project Generator // ---------------------------------------------------------------------------------------------------------- generatorProperties.setAppDefinition(app); @@ -331,18 +348,18 @@ private boolean isSameArtifact(Dependency dep1, Dependency dep2) { } /** - * If the visible metadata properties files are provided in the source project, add theirs' type and name filters - * to the existing visible configurations. + * If the visible metadata properties files are provided in the source project, add theirs' type and name filters to + * the existing visible configurations. * * @param sourceTypeFilters existing source type filters configured via the mojo parameter. - * @param nameFilters existing name filters configured via the mojo parameter. + * @param nameFilters existing name filters configured via the mojo parameter. */ private void populateVisiblePropertiesFromFile(List sourceTypeFilters, List nameFilters) { if (this.projectResourcesDir == null || !projectResourcesDir.exists()) { return; } - Optional optionalProperties = - loadVisiblePropertiesFromResource(FileUtils.getFile(projectResourcesDir, "META-INF", + Optional optionalProperties = loadVisiblePropertiesFromResource( + FileUtils.getFile(projectResourcesDir, "META-INF", VISIBLE_PROPERTIES_FILE_NAME)); optionalProperties.ifPresent(properties -> { addToFilters(properties.getProperty(CONFIGURATION_PROPERTIES_CLASSES), sourceTypeFilters); @@ -354,12 +371,12 @@ private void populateVisiblePropertiesFromFile(List sourceTypeFilters, L loadVisiblePropertiesFromResource(FileUtils.getFile( projectResourcesDir, "META-INF", DEPRECATED_WHITELIST_FILE_NAME)) - .ifPresent(properties -> { - getLog().warn(DEPRECATED_WHITELIST_FILE_NAME + " is deprecated." + - " Please use " + VISIBLE_PROPERTIES_FILE_NAME + " instead"); - addToFilters(properties.getProperty(CONFIGURATION_PROPERTIES_CLASSES), sourceTypeFilters); - addToFilters(properties.getProperty(CONFIGURATION_PROPERTIES_NAMES), nameFilters); - }); + .ifPresent(properties -> { + getLog().warn(DEPRECATED_WHITELIST_FILE_NAME + " is deprecated." + + " Please use " + VISIBLE_PROPERTIES_FILE_NAME + " instead"); + addToFilters(properties.getProperty(CONFIGURATION_PROPERTIES_CLASSES), sourceTypeFilters); + addToFilters(properties.getProperty(CONFIGURATION_PROPERTIES_NAMES), nameFilters); + }); } private Optional loadVisiblePropertiesFromResource(File visiblePropertiesFile) { @@ -378,7 +395,7 @@ private Optional loadVisiblePropertiesFromResource(File visiblePrope } private void addToFilters(String csvFilterProperties, List filterList) { - if (!StringUtils.isEmpty(csvFilterProperties)) { + if (!isEmpty(csvFilterProperties)) { for (String filterProperty : csvFilterProperties.trim().split(",")) { if (StringUtils.hasText(filterProperty)) { if (!filterList.contains(filterProperty.trim())) { @@ -390,8 +407,8 @@ private void addToFilters(String csvFilterProperties, List filterList) { } /** - * Section that allow to define Application and Binder configurations common across multiple applications - * and binders. + * Section that allow to define Application and Binder configurations common across multiple applications and + * binders. */ public static class Global { @@ -414,9 +431,8 @@ public Map getBinders() { public static class Application { /** - * Unique name of the application for the given type. - * The generated binder specific, applications have names that combine this application name, type as well - * as the name of the binder they are produced for. + * Unique name of the application for the given type. The generated binder specific, applications have names + * that combine this application name, type as well as the name of the binder they are produced for. */ private String name; @@ -543,8 +559,8 @@ public void setGroupId(String appGroupId) { } public String getFunctionDefinition() { - return (!StringUtils.isEmpty(this.functionDefinition)) ? this.functionDefinition : - this.name + this.functionType(); + return (!isEmpty(this.functionDefinition)) ? this.functionDefinition + : this.name + this.functionType(); } public void setFunctionDefinition(String functionDefinition) { @@ -687,7 +703,6 @@ public static class Binder { */ private final Maven maven = new Maven(); - public Maven getMaven() { return maven; } @@ -725,9 +740,14 @@ public static class Maven { * Custom maven plugins. Contributed to the generated POM's plugins section. * * Note: if the plugin definition uses a configuration block then the content must be wrapped within a - *
@code{
+		 *
+		 * 
+		 * @code{
 		 * 
-		 * }
section! Find more: {@link MavenXmlWriter#toXml(Plugin)}. + * } + *
+ * + * section! Find more: {@link MavenXmlWriter#toXml(Plugin)}. */ private List plugins = new ArrayList<>(); diff --git a/spring-cloud-dataflow-apps-metadata-plugin/pom.xml b/spring-cloud-dataflow-apps-metadata-plugin/pom.xml index d566b11..0144b4c 100644 --- a/spring-cloud-dataflow-apps-metadata-plugin/pom.xml +++ b/spring-cloud-dataflow-apps-metadata-plugin/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 spring-cloud-dataflow-apps-metadata-plugin @@ -13,12 +14,12 @@ - 3.6.3 - 4.12 - 3.11.1 - 1.8 - 5.2.8.RELEASE - 1.26 + 3.9.2 + 4.13.2 + 3.24.2 + 1.10.0 + 6.0.8 + 2.0 @@ -38,11 +39,11 @@ spring-beans ${spring.version}
- - org.yaml - snakeyaml - ${snakeyaml.version} - + + org.yaml + snakeyaml + ${snakeyaml.version} + org.apache.maven maven-core @@ -51,12 +52,13 @@ org.springframework.boot spring-boot-configuration-processor - 2.3.2.RELEASE + 3.1.0 + io.rsocket rsocket-core - 1.0.1 + 1.1.3 org.springframework.boot @@ -78,7 +80,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.4 + 3.9.0 provided @@ -93,14 +95,14 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5 + 3.9.0 org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + 17 + 17