in tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java [863:982]
private Set<String> executeOthers() throws Exception {
Path othersOutDir = this.othersOutDir.toPath();
getLog().info("Copying all Camel other json descriptors");
// lets use sorted set/maps
Set<Path> jsonFiles;
Set<Path> duplicateJsonFiles;
Set<Path> otherFiles;
Map<String, Set<String>> usedLabels = new TreeMap<>();
Set<Path> missingFirstVersions = new TreeSet<>();
otherFiles = allPropertiesFiles.stream().filter(p -> p.endsWith("other.properties"))
.collect(Collectors.toCollection(TreeSet::new));
jsonFiles = allJsonFiles.stream().filter(p -> {
Path m = getModule(p);
switch (m.getFileName().toString()) {
// we want to skip some JARs from core
case "camel-api":
case "camel-base":
case "camel-base-engine":
case "camel-core":
case "camel-core-catalog":
case "camel-core-engine":
case "camel-core-languages":
case "camel-core-model":
case "camel-core-processor":
case "camel-core-reifier":
case "camel-core-xml":
case "camel-management-api":
case "camel-support":
case "camel-util":
case "camel-xml-io":
case "camel-xml-io-util":
case "camel-xml-jaxb":
case "camel-xml-jaxp":
// and some from dsl
case "dsl-support":
case "camel-dsl-support":
case "camel-endpointdsl-support":
// and components with middle folders
case "camel-ai":
case "camel-as2":
case "camel-avro-rpc":
case "camel-aws":
case "camel-azure":
case "camel-box":
case "camel-cxf":
case "camel-debezium":
case "camel-debezium-common":
case "camel-fhir":
case "camel-google":
case "camel-http-base":
case "camel-http-common":
case "camel-huawei":
case "camel-infinispan":
case "camel-jetty-common":
case "camel-knative":
case "camel-langchain4j-core":
case "camel-microprofile":
case "camel-olingo2":
case "camel-olingo4":
case "camel-salesforce":
case "camel-servicenow":
case "camel-spring-parent":
case "camel-test":
case "camel-vertx":
return false;
default:
return true;
}
}).filter(p -> allModels.get(p) instanceof OtherModel).collect(Collectors.toCollection(TreeSet::new));
getLog().info("Found " + otherFiles.size() + " other.properties files");
getLog().info("Found " + jsonFiles.size() + " other json files");
// make sure to create out dir
Files.createDirectories(othersOutDir);
// Check duplicates
duplicateJsonFiles = getDuplicates(jsonFiles);
// Copy all descriptors
Map<Path, Path> newJsons = map(jsonFiles, p -> p, p -> othersOutDir.resolve(p.getFileName()));
try (Stream<Path> stream = list(othersOutDir).filter(p -> !newJsons.containsValue(p))) {
stream.forEach(this::delete);
}
newJsons.forEach(this::copy);
for (Path file : jsonFiles) {
OtherModel model = (OtherModel) allModels.get(file);
String name = asComponentName(file);
// grab the label, and remember it in the used labels
String label = model.getLabel();
if (!Strings.isNullOrEmpty(label)) {
String[] labels = label.split(",");
for (String s : labels) {
usedLabels.computeIfAbsent(s, k -> new TreeSet<>()).add(name);
}
}
// detect missing first version
String firstVersion = model.getFirstVersion();
if (Strings.isNullOrEmpty(firstVersion)) {
missingFirstVersions.add(file);
}
}
Path all = othersOutDir.resolve("../others.properties");
Set<String> otherNames
= jsonFiles.stream().map(PrepareCatalogMojo::asComponentName).collect(Collectors.toCollection(TreeSet::new));
FileUtil.updateFile(all, String.join("\n", otherNames) + "\n");
printOthersReport(jsonFiles, duplicateJsonFiles, usedLabels, missingFirstVersions);
return otherNames;
}