diff --git a/src/main/java/hudson/plugins/gradle/injection/MavenBuildScanInjection.java b/src/main/java/hudson/plugins/gradle/injection/MavenBuildScanInjection.java index 9f76edb4..1bffac41 100644 --- a/src/main/java/hudson/plugins/gradle/injection/MavenBuildScanInjection.java +++ b/src/main/java/hudson/plugins/gradle/injection/MavenBuildScanInjection.java @@ -73,12 +73,13 @@ private void inject(InjectionConfig config, Node node, FilePath nodeRootPath, Ma List extensions = new ArrayList<>(); FilePath controllerRootPath = Jenkins.get().getRootPath(); - for (Map.Entry entry : extensionsDigest.entrySet()) { - extensions.add(extensionsHandler.copyExtensionToAgent(entry.getKey(), controllerRootPath, nodeRootPath, entry.getValue())); - } + MavenExtension develocityMavenExtension = MavenExtension.getDevelocityMavenExtension(config.getMavenExtensionVersion()); + extensions.add(extensionsHandler.copyExtensionToAgent(develocityMavenExtension, controllerRootPath, nodeRootPath, extensionsDigest.get(develocityMavenExtension))); if (InjectionUtil.isInvalid(InjectionConfig.checkRequiredVersion(config.getCcudExtensionVersion()))) { extensionsHandler.deleteExtensionFromAgent(MavenExtension.CCUD, nodeRootPath); + } else { + extensions.add(extensionsHandler.copyExtensionToAgent(MavenExtension.CCUD, controllerRootPath, nodeRootPath, extensionsDigest.get(MavenExtension.CCUD))); } boolean isUnix = isUnix(node); diff --git a/src/main/java/hudson/plugins/gradle/injection/MavenExtensionDownloadHandler.java b/src/main/java/hudson/plugins/gradle/injection/MavenExtensionDownloadHandler.java index 513f2789..65a30f4c 100644 --- a/src/main/java/hudson/plugins/gradle/injection/MavenExtensionDownloadHandler.java +++ b/src/main/java/hudson/plugins/gradle/injection/MavenExtensionDownloadHandler.java @@ -50,7 +50,9 @@ public Map getExtensionDigests(Supplier rootDir, I MavenExtension develocityMavenExtension = MavenExtension.getDevelocityMavenExtension(injectionConfig.getMavenExtensionVersion()); getExtensionDigest(cacheDir, develocityMavenExtension).ifPresent(it -> extensionDigests.put(develocityMavenExtension, it)); - getExtensionDigest(cacheDir, MavenExtension.CCUD).ifPresent(it -> extensionDigests.put(MavenExtension.CCUD, it)); + if (InjectionUtil.isValid(InjectionConfig.checkRequiredVersion(injectionConfig.getCcudExtensionVersion()))) { + getExtensionDigest(cacheDir, MavenExtension.CCUD).ifPresent(it -> extensionDigests.put(MavenExtension.CCUD, it)); + } return extensionDigests; }