org.gradle.integtests.resolve.maven.MavenDependencyManagementImportOrderTest.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-api Show documentation
Show all versions of gradle-api Show documentation
Gradle 6.9.1 API redistribution.
/*
* Copyright 2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.integtests.resolve.maven;
import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.util.Requires
import org.gradle.util.TestPrecondition
import spock.lang.Issue
class MavenDependencyManagementImportOrderTest extends AbstractIntegrationSpec {
@Issue("https://github.com/gradle/gradle/issues/2212")
@Requires(TestPrecondition.ONLINE)
def "Verify that gradle resolves org.wildfly.swarm:undertow the same as maven"() {
when:
buildFile.text = """
${mavenCentralRepository()}
configurations {
test
}
dependencies {
test('org.wildfly.swarm:undertow:2017.5.0') {
exclude module: 'javax.el-impl'
}
}
task verifyUndertowVersion {
doLast {
def fileNames = configurations.test.files.collect { it.name }
assert fileNames.contains('undertow-servlet-1.4.11.Final.jar')
assert !fileNames.contains('undertow-servlet-1.2.9.Final.jar')
}
}
"""
then:
succeeds 'verifyUndertowVersion'
}
@Issue("https://github.com/gradle/gradle/issues/2212")
def "Verify that if multiple boms declare the same dependency, the first bom wins"() {
file("mavenRoot/group/level1/1/level1-1.pom").text = '''\
4.0.0
group
level1
1
jar
group
bom1
1
import
group
bom2
1
import
group
level2
'''
file("mavenRoot/group/level1/1/level1-1.jar").text = 'foo'
file("mavenRoot/group/bom1/1/bom1-1.pom").text = '''\
4.0.0
group
bom1
1
pom
group
level2
1
'''
file("mavenRoot/group/bom2/1/bom2-1.pom").text = '''\
4.0.0
group
bom2
1
pom
group
level2
2
'''
file("mavenRoot/group/level2/1/level2-1.pom").text = '''\
4.0.0
group
level2
1
jar
'''
file("mavenRoot/group/level2/1/level2-1.jar").text = 'foo'
file("mavenRoot/group/level2/2/level2-2.pom").text = '''\
4.0.0
group
level2
1
jar
'''
file("mavenRoot/group/level2/2/level2-2.jar").text = 'foo'
when:
buildFile.text = '''
repositories {
maven {
url uri(file('mavenRoot'))
}
}
configurations {
test
}
dependencies {
test 'group:level1:1'
}
task verifyVersion {
doLast {
def fileNames = configurations.test.files.collect { it.name }
assert fileNames.contains('level1-1.jar')
assert fileNames.contains('level2-1.jar')
assert !fileNames.contains('level2-2.jar')
}
}
'''
then:
succeeds 'verifyVersion'
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy