File tree Expand file tree Collapse file tree 4 files changed +50
-4
lines changed
main/java/io/spring/gradle/dependencymanagement/internal
groovy/io/spring/gradle/dependencymanagement
resources/maven-repo/test/malformed-exclude/1.0 Expand file tree Collapse file tree 4 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2014-2020 the original author or authors.
2+ * Copyright 2014-2021 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -34,8 +34,8 @@ public class Exclusion {
3434 * @param artifactId artifact ID
3535 */
3636 public Exclusion (String groupId , String artifactId ) {
37- this .groupId = groupId ;
38- this .artifactId = artifactId ;
37+ this .groupId = ( groupId != null ) ? groupId : "" ;
38+ this .artifactId = ( artifactId != null ) ? artifactId : "" ;
3939 }
4040
4141 /**
Original file line number Diff line number Diff line change 11/*
2- * Copyright 2014-2020 the original author or authors.
2+ * Copyright 2014-2021 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -1472,4 +1472,23 @@ public class DependencyManagementPluginSpec extends Specification {
14721472 project. dependencyManagement. managedVersions. isEmpty()
14731473 }
14741474
1475+ def ' An exclusion that is malformed is tolerated' () {
1476+ given : ' A project with the plugin applied'
1477+ project. apply plugin : ' io.spring.dependency-management'
1478+ project. apply plugin : ' java'
1479+ project. repositories {
1480+ maven { url new File (" src/test/resources/maven-repo" ). toURI(). toURL(). toString() }
1481+ }
1482+ when : ' it depends on a module with malformed exclusions'
1483+ project. dependencies {
1484+ compile ' test:malformed-exclude:1.0'
1485+ }
1486+ def files = project. configurations. compile. resolve()
1487+ then : " the project can be built"
1488+ files. size() == 3
1489+ files. collect { it. name }. containsAll([' malformed-exclude-1.0.jar' ,
1490+ ' spring-core-4.1.2.RELEASE.jar' ,
1491+ ' commons-logging-1.1.3.jar' ])
1492+ }
1493+
14751494}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
4+ <modelVersion >4.0.0</modelVersion >
5+
6+ <groupId >test</groupId >
7+ <artifactId >malformed-exclude</artifactId >
8+ <version >1.0</version >
9+ <packaging >jar</packaging >
10+
11+ <dependencies >
12+ <dependency >
13+ <groupId >org.springframework</groupId >
14+ <artifactId >spring-core</artifactId >
15+ <version >4.1.2.RELEASE</version >
16+ <exclusions >
17+ <exclusion >
18+ <groupId >commons-logging</groupId >
19+ </exclusion >
20+ <exclusion >
21+ <artifactId >commons-logging</artifactId >
22+ </exclusion >
23+ </exclusions >
24+ </dependency >
25+ </dependencies >
26+
27+ </project >
You can’t perform that action at this time.
0 commit comments