|
1 | 1 | /* |
2 | | - * Copyright 2012-2021 the original author or authors. |
| 2 | + * Copyright 2012-2022 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -75,12 +75,14 @@ void libraryModulesAreIncludedInDependencyManagementOfGeneratedPom() throws IOEx |
75 | 75 | assertThat(dependency).textAtPath("version").isEqualTo("${activemq.version}"); |
76 | 76 | assertThat(dependency).textAtPath("scope").isNullOrEmpty(); |
77 | 77 | assertThat(dependency).textAtPath("type").isNullOrEmpty(); |
| 78 | +assertThat(dependency).textAtPath("classifier").isNullOrEmpty(); |
78 | 79 | dependency = pom.nodeAtPath("//dependencyManagement/dependencies/dependency[2]"); |
79 | 80 | assertThat(dependency).textAtPath("groupId").isEqualTo("org.apache.activemq"); |
80 | 81 | assertThat(dependency).textAtPath("artifactId").isEqualTo("activemq-blueprint"); |
81 | 82 | assertThat(dependency).textAtPath("version").isEqualTo("${activemq.version}"); |
82 | 83 | assertThat(dependency).textAtPath("scope").isNullOrEmpty(); |
83 | 84 | assertThat(dependency).textAtPath("type").isNullOrEmpty(); |
| 85 | +assertThat(dependency).textAtPath("classifier").isNullOrEmpty(); |
84 | 86 | }); |
85 | 87 | } |
86 | 88 |
|
@@ -135,6 +137,7 @@ void libraryImportsAreIncludedInDependencyManagementOfGeneratedPom() throws Exce |
135 | 137 | assertThat(dependency).textAtPath("version").isEqualTo("${jackson-bom.version}"); |
136 | 138 | assertThat(dependency).textAtPath("scope").isEqualTo("import"); |
137 | 139 | assertThat(dependency).textAtPath("type").isEqualTo("pom"); |
| 140 | +assertThat(dependency).textAtPath("classifier").isNullOrEmpty(); |
138 | 141 | }); |
139 | 142 | } |
140 | 143 |
|
@@ -164,6 +167,7 @@ void moduleExclusionsAreIncludedInDependencyManagementOfGeneratedPom() throws IO |
164 | 167 | assertThat(dependency).textAtPath("version").isEqualTo("${mysql.version}"); |
165 | 168 | assertThat(dependency).textAtPath("scope").isNullOrEmpty(); |
166 | 169 | assertThat(dependency).textAtPath("type").isNullOrEmpty(); |
| 170 | +assertThat(dependency).textAtPath("classifier").isNullOrEmpty(); |
167 | 171 | NodeAssert exclusion = dependency.nodeAtPath("exclusions/exclusion"); |
168 | 172 | assertThat(exclusion).textAtPath("groupId").isEqualTo("com.google.protobuf"); |
169 | 173 | assertThat(exclusion).textAtPath("artifactId").isEqualTo("protobuf-java"); |
@@ -196,10 +200,69 @@ void moduleTypesAreIncludedInDependencyManagementOfGeneratedPom() throws IOExcep |
196 | 200 | assertThat(dependency).textAtPath("version").isEqualTo("${elasticsearch.version}"); |
197 | 201 | assertThat(dependency).textAtPath("scope").isNullOrEmpty(); |
198 | 202 | assertThat(dependency).textAtPath("type").isEqualTo("zip"); |
| 203 | +assertThat(dependency).textAtPath("classifier").isNullOrEmpty(); |
199 | 204 | assertThat(dependency).nodeAtPath("exclusions").isNull(); |
200 | 205 | }); |
201 | 206 | } |
202 | 207 |
|
| 208 | +@Test |
| 209 | +void moduleClassifiersAreIncludedInDependencyManagementOfGeneratedPom() throws IOException { |
| 210 | +try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) { |
| 211 | +out.println("plugins {"); |
| 212 | +out.println(" id 'org.springframework.boot.bom'"); |
| 213 | +out.println("}"); |
| 214 | +out.println("bom {"); |
| 215 | +out.println(" library('Kafka', '2.7.2') {"); |
| 216 | +out.println(" group('org.apache.kafka') {"); |
| 217 | +out.println(" modules = ["); |
| 218 | +out.println(" 'connect-api',"); |
| 219 | +out.println(" 'generator',"); |
| 220 | +out.println(" 'generator' {"); |
| 221 | +out.println(" classifier = 'test'"); |
| 222 | +out.println(" },"); |
| 223 | +out.println(" 'kafka-tools',"); |
| 224 | +out.println(" ]"); |
| 225 | +out.println(" }"); |
| 226 | +out.println(" }"); |
| 227 | +out.println("}"); |
| 228 | +} |
| 229 | +generatePom((pom) -> { |
| 230 | +assertThat(pom).textAtPath("//properties/kafka.version").isEqualTo("2.7.2"); |
| 231 | +NodeAssert connectApi = pom.nodeAtPath("//dependencyManagement/dependencies/dependency[1]"); |
| 232 | +assertThat(connectApi).textAtPath("groupId").isEqualTo("org.apache.kafka"); |
| 233 | +assertThat(connectApi).textAtPath("artifactId").isEqualTo("connect-api"); |
| 234 | +assertThat(connectApi).textAtPath("version").isEqualTo("${kafka.version}"); |
| 235 | +assertThat(connectApi).textAtPath("scope").isNullOrEmpty(); |
| 236 | +assertThat(connectApi).textAtPath("type").isNullOrEmpty(); |
| 237 | +assertThat(connectApi).textAtPath("classifier").isNullOrEmpty(); |
| 238 | +assertThat(connectApi).nodeAtPath("exclusions").isNull(); |
| 239 | +NodeAssert generator = pom.nodeAtPath("//dependencyManagement/dependencies/dependency[2]"); |
| 240 | +assertThat(generator).textAtPath("groupId").isEqualTo("org.apache.kafka"); |
| 241 | +assertThat(generator).textAtPath("artifactId").isEqualTo("generator"); |
| 242 | +assertThat(generator).textAtPath("version").isEqualTo("${kafka.version}"); |
| 243 | +assertThat(generator).textAtPath("scope").isNullOrEmpty(); |
| 244 | +assertThat(generator).textAtPath("type").isNullOrEmpty(); |
| 245 | +assertThat(generator).textAtPath("classifier").isNullOrEmpty(); |
| 246 | +assertThat(generator).nodeAtPath("exclusions").isNull(); |
| 247 | +NodeAssert generatorTest = pom.nodeAtPath("//dependencyManagement/dependencies/dependency[3]"); |
| 248 | +assertThat(generatorTest).textAtPath("groupId").isEqualTo("org.apache.kafka"); |
| 249 | +assertThat(generatorTest).textAtPath("artifactId").isEqualTo("generator"); |
| 250 | +assertThat(generatorTest).textAtPath("version").isEqualTo("${kafka.version}"); |
| 251 | +assertThat(generatorTest).textAtPath("scope").isNullOrEmpty(); |
| 252 | +assertThat(generatorTest).textAtPath("type").isNullOrEmpty(); |
| 253 | +assertThat(generatorTest).textAtPath("classifier").isEqualTo("test"); |
| 254 | +assertThat(generatorTest).nodeAtPath("exclusions").isNull(); |
| 255 | +NodeAssert kafkaTools = pom.nodeAtPath("//dependencyManagement/dependencies/dependency[4]"); |
| 256 | +assertThat(kafkaTools).textAtPath("groupId").isEqualTo("org.apache.kafka"); |
| 257 | +assertThat(kafkaTools).textAtPath("artifactId").isEqualTo("kafka-tools"); |
| 258 | +assertThat(kafkaTools).textAtPath("version").isEqualTo("${kafka.version}"); |
| 259 | +assertThat(kafkaTools).textAtPath("scope").isNullOrEmpty(); |
| 260 | +assertThat(kafkaTools).textAtPath("type").isNullOrEmpty(); |
| 261 | +assertThat(kafkaTools).textAtPath("classifier").isNullOrEmpty(); |
| 262 | +assertThat(kafkaTools).nodeAtPath("exclusions").isNull(); |
| 263 | +}); |
| 264 | +} |
| 265 | + |
203 | 266 | @Test |
204 | 267 | void libraryNamedSpringBootHasNoVersionProperty() throws IOException { |
205 | 268 | try (PrintWriter out = new PrintWriter(new FileWriter(this.buildFile))) { |
|
0 commit comments