Merge branch '3.2.x'

Closes gh-40324
This commit is contained in:
Andy Wilkinson
2024-04-11 16:54:46 +01:00
6 changed files with 147 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-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.
@@ -71,9 +71,10 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
/**
* Collection of artifact definitions to include. The {@link Include} element defines
* mandatory {@code groupId} and {@code artifactId} properties and an optional
* mandatory {@code groupId} and {@code artifactId} properties and an optional
* {@code classifier} property.
* mandatory {@code groupId} and {@code artifactId} components and an optional
* {@code classifier} component. When configured as a property, values should be
* comma-separated with colon-separated components:
* {@code groupId:artifactId,groupId:artifactId:classifier}
* @since 1.2.0
*/
@Parameter(property = "spring-boot.includes")
@@ -81,8 +82,10 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
/**
* Collection of artifact definitions to exclude. The {@link Exclude} element defines
* mandatory {@code groupId} and {@code artifactId} properties and an optional
* {@code classifier} property.
* mandatory {@code groupId} and {@code artifactId} components and an optional
* {@code classifier} component. When configured as a property, values should be
* comma-separated with colon-separated components:
* {@code groupId:artifactId,groupId:artifactId:classifier}
* @since 1.1.0
*/
@Parameter(property = "spring-boot.excludes")

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-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.
@@ -18,13 +18,16 @@ package org.springframework.boot.maven;
import org.apache.maven.plugins.annotations.Parameter;
import org.springframework.util.Assert;
/**
* A model for a dependency to include or exclude.
*
* @author Stephane Nicoll
* @author David Turanski
* @since 3.1.11
*/
abstract class FilterableDependency {
public abstract class FilterableDependency {
/**
* The groupId of the artifact to exclude.
@@ -68,4 +71,20 @@ abstract class FilterableDependency {
this.classifier = classifier;
}
/**
* Configures the include or exclude using a user-provided property in the form
* {@code groupId:artifactId} or {@code groupId:artifactId:classifier}.
* @param property the user-provided property
*/
public void set(String property) {
String[] parts = property.split(":");
Assert.isTrue(parts.length == 2 || parts.length == 3, getClass().getSimpleName()
+ " must be in the form groupId:artifactId or groupId:artifactId:classifier");
setGroupId(parts[0]);
setArtifactId(parts[1]);
if (parts.length == 3) {
setClassifier(parts[2]);
}
}
}