mirror of
https://gitee.com/dcren/initializr.git
synced 2025-12-03 11:54:03 +08:00
Add dependency type attribute
See gh-226
This commit is contained in:
committed by
Stephane Nicoll
parent
d8a0651ad4
commit
70c05ba246
@@ -75,6 +75,30 @@ class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
.hasSpringBootStarterDependency('web')
|
||||
}
|
||||
|
||||
@Test
|
||||
void mavenPomWithTarDependency() {
|
||||
def dependency = new Dependency(id: 'custom-artifact', groupId: 'org.foo', artifactId: 'custom-artifact', type: "tar.gz")
|
||||
def metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup('test', dependency).build()
|
||||
applyMetadata(metadata)
|
||||
|
||||
def request = createProjectRequest('custom-artifact')
|
||||
generateMavenPom(request).hasDependency(dependency)
|
||||
.hasDependenciesCount(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
void gradleBuildWithTarDependency() {
|
||||
def dependency = new Dependency(id: 'custom-artifact', groupId: 'org.foo', artifactId: 'custom-artifact', type: "tar.gz")
|
||||
def metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup('test', dependency).build()
|
||||
applyMetadata(metadata)
|
||||
|
||||
def request = createProjectRequest('custom-artifact')
|
||||
generateGradleBuild(request)
|
||||
.contains("compile('org.foo:custom-artifact@tar.gz')")
|
||||
}
|
||||
|
||||
@Test
|
||||
void mavenPomWithWebFacet() {
|
||||
def dependency = new Dependency(id: 'thymeleaf', groupId: 'org.foo', artifactId: 'thymeleaf')
|
||||
|
||||
@@ -146,6 +146,9 @@ class PomAssert {
|
||||
if (expected.scope) {
|
||||
assertEquals "Wrong scope for $dependency", expected.scope, dependency.scope
|
||||
}
|
||||
if (expected.type) {
|
||||
assertEquals "Wrong type for $dependency", expected.type, dependency.type
|
||||
}
|
||||
this
|
||||
}
|
||||
|
||||
@@ -238,6 +241,10 @@ class PomAssert {
|
||||
if (scope.length > 0) {
|
||||
dependency.scope = scope.item(0).textContent
|
||||
}
|
||||
def type = element.getElementsByTagName('type')
|
||||
if (type.length > 0) {
|
||||
dependency.type = type.item(0).textContent
|
||||
}
|
||||
def id = dependency.generateId()
|
||||
assertFalse("Duplicate dependency with id $id", dependencies.containsKey(id))
|
||||
dependencies[id] = dependency
|
||||
|
||||
Reference in New Issue
Block a user