From 8bc96249ef3fd0f241abeb1c52a745e2532e8a28 Mon Sep 17 00:00:00 2001 From: Dirk Mahler Date: Wed, 11 Dec 2024 12:47:19 +0100 Subject: [PATCH] #727 us plugin artifactId as a single string instead of a list of strings in plugin.yml --- .../shared/aether/AetherArtifactProvider.java | 22 ++++++------------- .../shared/aether/configuration/Plugin.java | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/AetherArtifactProvider.java b/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/AetherArtifactProvider.java index 7700238fc..21cc2cf75 100644 --- a/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/AetherArtifactProvider.java +++ b/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/AetherArtifactProvider.java @@ -47,7 +47,7 @@ public List resolve(List plugins) { private List getDependencies(List plugins) { return plugins.stream() - .flatMap(plugin -> getPluginDependencies(plugin).stream()) + .map(this::toDependency) .collect(toList()); } @@ -60,21 +60,15 @@ private DependencyResult resolvePlugins(List dependencies) { return dependencyResult; } - private List getPluginDependencies(Plugin plugin) { - List exlusions = plugin.exclusions() + private Dependency toDependency(Plugin plugin) { + List exclusions = plugin.exclusions() .stream() .map(AetherArtifactProvider::getPluginExclusions) .flatMap(Collection::stream) .collect(toList()); - return plugin.artifactId() - .stream() - .map(artifactId -> getDependency(plugin, artifactId.trim(), exlusions)) - .collect(toList()); - } - - private static Dependency getDependency(Plugin plugin, String artifactId, List exlusions) { - return new Dependency(new DefaultArtifact(plugin.groupId(), artifactId, plugin.classifier() - .orElse(null), plugin.type(), plugin.version()), JavaScopes.RUNTIME, false, exlusions); + return new Dependency(new DefaultArtifact(plugin.groupId(), plugin.artifactId() + .trim(), plugin.classifier() + .orElse(null), plugin.type(), plugin.version()), JavaScopes.RUNTIME, false, exclusions); } private static List getPluginExclusions(com.buschmais.jqassistant.core.shared.aether.configuration.Exclusion exclusion) { @@ -99,9 +93,7 @@ private DependencyResult resolveDependencies(DependencyFilter classpathFilter, L private void logDependencyTree(DependencyNode node, int indent) { StringBuilder builder = new StringBuilder(); - for (int i = 0; i < indent; i++) { - builder.append(' '); - } + builder.append(" ".repeat(indent)); Artifact artifact = node.getArtifact(); if (artifact != null) { log.info("{}{}", builder, artifact); diff --git a/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/configuration/Plugin.java b/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/configuration/Plugin.java index f716e4d2a..782c72333 100644 --- a/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/configuration/Plugin.java +++ b/core/shared/src/main/java/com/buschmais/jqassistant/core/shared/aether/configuration/Plugin.java @@ -19,7 +19,7 @@ public interface Plugin { Optional classifier(); @Description("The artifactId of the plugin.") - List artifactId(); + String artifactId(); @Description("The type (extension) of the plugin.") @WithDefault("jar")