This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new b907f40ade5 CAMEL-22063: camel-spring-boot-generator-maven-plugin:
prioritize deprecated from starter in catalog (#1436)
b907f40ade5 is described below
commit b907f40ade53db0055d7ddd5bf918a2de577c04f
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed May 14 09:21:52 2025 +0200
CAMEL-22063: camel-spring-boot-generator-maven-plugin: prioritize
deprecated from starter in catalog (#1436)
---
.../maven/PrepareCatalogSpringBootMojo.java | 57 ++++++++++++++++------
1 file changed, 42 insertions(+), 15 deletions(-)
diff --git
a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/PrepareCatalogSpringBootMojo.java
b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/PrepareCatalogSpringBootMojo.java
index 847d0005a2f..642d5b7a0af 100644
---
a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/PrepareCatalogSpringBootMojo.java
+++
b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/PrepareCatalogSpringBootMojo.java
@@ -62,14 +62,15 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
throws MojoExecutionException, MojoFailureException, IOException {
try (JarFile jar = getJarFile(groupId, artifactId)) {
if (jar != null) {
+ boolean deprecated = isDeprecated();
Map<String, Supplier<String>> files = getJSonFiles(jar);
- executeOthers(jar, files);
- executeComponents(jar, files);
- executeDataFormats(jar, files);
- executeLanguages(jar, files);
- executeTransformers(jar, files);
- executeDevConsoles(jar, files);
- executeBeans(jar, files);
+ executeOthers(jar, files, deprecated);
+ executeComponents(jar, files, deprecated);
+ executeDataFormats(jar, files, deprecated);
+ executeLanguages(jar, files, deprecated);
+ executeTransformers(jar, files, deprecated);
+ executeDevConsoles(jar, files, deprecated);
+ executeBeans(jar, files, deprecated);
}
}
// special to include core languages
@@ -77,18 +78,23 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
try (JarFile jar = getJarFile("org.apache.camel",
"camel-core-languages")) {
if (jar != null) {
Map<String, Supplier<String>> files = getJSonFiles(jar);
- executeLanguages(jar, files);
+ // cannot be deprecated
+ executeLanguages(jar, files, false);
}
}
}
}
+ protected boolean isDeprecated() {
+ return project.getName() != null &&
project.getName().contains("(deprecated)");
+ }
+
@Override
protected boolean isIgnore(String artifactId) {
return Arrays.asList(IGNORE_MODULES).contains(artifactId);
}
- protected void executeComponents(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles)
+ protected void executeComponents(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles, boolean deprecated)
throws MojoExecutionException, MojoFailureException, IOException {
List<String> componentNames = findComponentNames(componentJar);
if (!componentNames.isEmpty()) {
@@ -104,6 +110,9 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
"\"artifactId\": \"" +
project.getArtifactId() + "\"")
.replace("\"version\": \"" + getMainDepVersion() +
"\"",
"\"version\": \"" + project.getVersion() +
"\"");
+ if (deprecated) {
+ json = json.replaceFirst("\"deprecated\": false",
"\"deprecated\": true");
+ }
writeIfChanged(json,
new File(catalogDir,
"src/main/resources/org/apache/camel/springboot/catalog/components/"
+ componentName + ".json"));
@@ -119,7 +128,7 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
}
}
- protected void executeDataFormats(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles)
+ protected void executeDataFormats(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles, boolean deprecated)
throws MojoExecutionException, MojoFailureException, IOException {
List<String> dataFormatNames = findDataFormatNames(componentJar);
if (!dataFormatNames.isEmpty()) {
@@ -135,6 +144,9 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
"\"artifactId\": \"" +
project.getArtifactId() + "\"")
.replace("\"version\": \"" + getMainDepVersion() +
"\"",
"\"version\": \"" + project.getVersion() +
"\"");
+ if (deprecated) {
+ json = json.replaceFirst("\"deprecated\": false",
"\"deprecated\": true");
+ }
writeIfChanged(json,
new File(catalogDir,
"src/main/resources/org/apache/camel/springboot/catalog/dataformats/"
+ dataformatName + ".json"));
@@ -150,7 +162,7 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
}
}
- protected void executeLanguages(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles)
+ protected void executeLanguages(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles, boolean deprecated)
throws MojoExecutionException, MojoFailureException, IOException {
List<String> languageNames = findLanguageNames(componentJar);
if (!languageNames.isEmpty()) {
@@ -166,6 +178,9 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
"\"artifactId\": \"" +
project.getArtifactId() + "\"")
.replace("\"version\": \"" + getMainDepVersion() +
"\"",
"\"version\": \"" + project.getVersion() +
"\"");
+ if (deprecated) {
+ json = json.replaceFirst("\"deprecated\": false",
"\"deprecated\": true");
+ }
writeIfChanged(json,
new File(catalogDir,
"src/main/resources/org/apache/camel/springboot/catalog/languages/"
+ languageName + ".json"));
@@ -181,7 +196,7 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
}
}
- protected void executeOthers(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles)
+ protected void executeOthers(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles, boolean deprecated)
throws MojoExecutionException, MojoFailureException, IOException {
// The json files for 'other' components are in the root of the jars
List<String> otherNames = findNames(componentJar, "").stream()
@@ -203,6 +218,9 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
"\"artifactId\": \"" +
project.getArtifactId() + "\"")
.replace("\"version\": \"" + getMainDepVersion() +
"\"",
"\"version\": \"" + project.getVersion() +
"\"");
+ if (deprecated) {
+ json = json.replaceFirst("\"deprecated\": false",
"\"deprecated\": true");
+ }
writeIfChanged(json, new File(catalogDir,
"src/main/resources/org/apache/camel/springboot/catalog/others/" + otherName +
".json"));
actual.add(otherName);
@@ -217,7 +235,7 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
}
}
- protected void executeTransformers(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles)
+ protected void executeTransformers(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles, boolean deprecated)
throws MojoExecutionException, MojoFailureException, IOException {
List<String> transformerNames = findTransformerNames(componentJar);
if (!transformerNames.isEmpty()) {
@@ -233,6 +251,9 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
"\"artifactId\": \"" +
project.getArtifactId() + "\"")
.replace("\"version\": \"" + getMainDepVersion() +
"\"",
"\"version\": \"" + project.getVersion() +
"\"");
+ if (deprecated) {
+ json = json.replaceFirst("\"deprecated\": false",
"\"deprecated\": true");
+ }
writeIfChanged(json,
new File(catalogDir,
"src/main/resources/org/apache/camel/springboot/catalog/transformers/"
+ transformerName + ".json"));
@@ -248,7 +269,7 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
}
}
- protected void executeDevConsoles(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles)
+ protected void executeDevConsoles(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles, boolean deprecated)
throws MojoExecutionException, MojoFailureException, IOException {
List<String> names = findDevConsoleNames(componentJar);
if (!names.isEmpty()) {
@@ -264,6 +285,9 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
"\"artifactId\": \"" +
project.getArtifactId() + "\"")
.replace("\"version\": \"" + getMainDepVersion() +
"\"",
"\"version\": \"" + project.getVersion() +
"\"");
+ if (deprecated) {
+ json = json.replaceFirst("\"deprecated\": false",
"\"deprecated\": true");
+ }
writeIfChanged(json,
new File(catalogDir,
"src/main/resources/org/apache/camel/springboot/catalog/dev-consoles/"
+ name + ".json"));
@@ -279,7 +303,7 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
}
}
- protected void executeBeans(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles)
+ protected void executeBeans(JarFile componentJar, Map<String,
Supplier<String>> jsonFiles, boolean deprecated)
throws MojoExecutionException, MojoFailureException, IOException {
List<String> names = findBeanNames(componentJar);
if (!names.isEmpty()) {
@@ -295,6 +319,9 @@ public class PrepareCatalogSpringBootMojo extends
AbstractSpringBootGenerator {
"\"artifactId\": \"" +
project.getArtifactId() + "\"")
.replace("\"version\": \"" + getMainDepVersion() +
"\"",
"\"version\": \"" + project.getVersion() +
"\"");
+ if (deprecated) {
+ json = json.replaceFirst("\"deprecated\": false",
"\"deprecated\": true");
+ }
writeIfChanged(json,
new File(catalogDir,
"src/main/resources/org/apache/camel/springboot/catalog/beans/"
+ name + ".json"));