diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc index e2f8b8b..d20bf89 100644 --- a/src/docs/asciidoc/index.adoc +++ b/src/docs/asciidoc/index.adoc @@ -590,7 +590,7 @@ dependencyManagement { .Kotlin ---- dependencyManagement { - overriddenByDependencies(false) + isOverriddenByDependencies = false } ---- @@ -782,7 +782,7 @@ dependencyManagement { .Kotlin ---- dependencyManagement { - applyMavenExclusions(false) + isApplyMavenExclusions = false } ---- @@ -864,7 +864,7 @@ dependencyManagement { ---- dependencyManagement { generatedPomCustomization { - enabled(false) + isEnabled = false } } ---- diff --git a/src/main/java/io/spring/gradle/dependencymanagement/dsl/DependencyManagementExtension.java b/src/main/java/io/spring/gradle/dependencymanagement/dsl/DependencyManagementExtension.java index 3b8910e..cdea02e 100644 --- a/src/main/java/io/spring/gradle/dependencymanagement/dsl/DependencyManagementExtension.java +++ b/src/main/java/io/spring/gradle/dependencymanagement/dsl/DependencyManagementExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ * Extension that provides the entry point to the dependency management plugin's DSL. * * @author Andy Wilkinson + * @author Yanming Zhou */ public interface DependencyManagementExtension extends DependencyManagementHandler { @@ -68,6 +69,14 @@ public interface DependencyManagementExtension extends DependencyManagementHandl */ PomDependencyManagementConfigurer getPomConfigurer(); + /** + * Whether or not Maven-style exclusions should be applied during dependency + * resolutions. The default is {@code true}. + * @return whether or not Maven-style exclusions should be applied during dependency + * resolutions. + */ + boolean isApplyMavenExclusions(); + /** * Set whether or not Maven-style exclusions should be applied during dependency * resolutions. The default is {@code true}. @@ -84,6 +93,14 @@ public interface DependencyManagementExtension extends DependencyManagementHandl */ void applyMavenExclusions(boolean applyMavenExclusions); + /** + * Whether dependency management should be overridden by versions declared on a + * project's dependencies. The default is {@code true}. + * @return Whether dependency management should be overridden by versions declared on + * a project's dependencies. + */ + boolean isOverriddenByDependencies(); + /** * Set whether dependency management should be overridden by versions declared on a * project's dependencies. The default is {@code true}. diff --git a/src/main/java/io/spring/gradle/dependencymanagement/dsl/GeneratedPomCustomizationHandler.java b/src/main/java/io/spring/gradle/dependencymanagement/dsl/GeneratedPomCustomizationHandler.java index ac80cc0..67c30e6 100644 --- a/src/main/java/io/spring/gradle/dependencymanagement/dsl/GeneratedPomCustomizationHandler.java +++ b/src/main/java/io/spring/gradle/dependencymanagement/dsl/GeneratedPomCustomizationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,17 @@ * A handler for configuring the customization of generated POMs. * * @author Andy Wilkinson + * @author Yanming Zhou */ public interface GeneratedPomCustomizationHandler { + /** + * Whether or not customization of generated poms is enabled. Defaults to + * {@code true}. + * @return whether or not customization is enabled + */ + boolean isEnabled(); + /** * Sets whether or not customization of generated poms is enabled. Defaults to * {@code true}. diff --git a/src/main/java/io/spring/gradle/dependencymanagement/internal/DependencyManagementSettings.java b/src/main/java/io/spring/gradle/dependencymanagement/internal/DependencyManagementSettings.java index e453897..71ec7a7 100644 --- a/src/main/java/io/spring/gradle/dependencymanagement/internal/DependencyManagementSettings.java +++ b/src/main/java/io/spring/gradle/dependencymanagement/internal/DependencyManagementSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ * Settings that control dependency management behaviour. * * @author Andy Wilkinson + * @author Yanming Zhou */ public class DependencyManagementSettings { @@ -35,7 +36,7 @@ public class DependencyManagementSettings { * @return {@code true} if Maven-style exclusions should be applied, otherwise * {@code false} */ - boolean isApplyMavenExclusions() { + public boolean isApplyMavenExclusions() { return this.applyMavenExclusions; } @@ -56,7 +57,7 @@ public void setApplyMavenExclusions(boolean applyMavenExclusions) { * versions, otherwise {@code * false} */ - boolean isOverriddenByDependencies() { + public boolean isOverriddenByDependencies() { return this.overriddenByDependencies; } diff --git a/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardDependencyManagementExtension.java b/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardDependencyManagementExtension.java index afc8986..0817ca9 100644 --- a/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardDependencyManagementExtension.java +++ b/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardDependencyManagementExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ * Standard implementation of {@link DependencyManagementExtension}. * * @author Andy Wilkinson + * @author Yanming Zhou */ public class StandardDependencyManagementExtension extends GroovyObjectSupport implements DependencyManagementExtension { @@ -206,6 +207,11 @@ private DependencyManagementHandler handlerForConfiguration(Configuration config return new StandardDependencyManagementHandler(this.dependencyManagementContainer, configuration); } + @Override + public boolean isApplyMavenExclusions() { + return this.dependencyManagementSettings.isApplyMavenExclusions(); + } + @Override public void setApplyMavenExclusions(boolean applyMavenExclusions) { this.dependencyManagementSettings.setApplyMavenExclusions(applyMavenExclusions); @@ -216,6 +222,11 @@ public void applyMavenExclusions(boolean applyMavenExclusions) { this.dependencyManagementSettings.setApplyMavenExclusions(applyMavenExclusions); } + @Override + public boolean isOverriddenByDependencies() { + return this.dependencyManagementSettings.isOverriddenByDependencies(); + } + @Override public void setOverriddenByDependencies(boolean overriddenByDependencies) { this.dependencyManagementSettings.setOverriddenByDependencies(overriddenByDependencies); diff --git a/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardGeneratedPomCustomizationHandler.java b/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardGeneratedPomCustomizationHandler.java index 2385316..4074575 100644 --- a/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardGeneratedPomCustomizationHandler.java +++ b/src/main/java/io/spring/gradle/dependencymanagement/internal/dsl/StandardGeneratedPomCustomizationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2022 the original author or authors. + * Copyright 2014-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ * Standard implementation of {@link GeneratedPomCustomizationHandler}. * * @author Andy Wilkinson + * @author Yanming Zhou */ class StandardGeneratedPomCustomizationHandler implements GeneratedPomCustomizationHandler { @@ -32,6 +33,11 @@ class StandardGeneratedPomCustomizationHandler implements GeneratedPomCustomizat this.settings = settings; } + @Override + public boolean isEnabled() { + return this.settings.isEnabled(); + } + @Override public void setEnabled(boolean enabled) { this.settings.setEnabled(enabled);