org.gradle.integtests.resolve.ivy.IvyBrokenDescriptorIntegrationTest.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 2013 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.ivy
import org.gradle.integtests.fixtures.AbstractHttpDependencyResolutionTest
class IvyBrokenDescriptorIntegrationTest extends AbstractHttpDependencyResolutionTest {
def setup() {
buildFile << """
repositories {
ivy {
url "${ivyHttpRepo.uri}"
}
}
configurations { compile }
task showBroken { doLast { println configurations.compile.files } }
"""
}
def "reports Ivy descriptor that cannot be parsed"() {
given:
buildFile << """
dependencies {
compile 'group:projectA:1.2'
}
"""
and:
def module = ivyHttpRepo.module('group', 'projectA', '1.2').publish()
module.ivyFile.text = ""
when:
module.ivy.expectGet()
then:
fails "showBroken"
failure
.assertResolutionFailure(":compile")
.assertHasCause("Could not parse Ivy file ${module.ivy.uri}")
.assertHasCause("invalid version null")
}
def "reports local Ivy descriptor that cannot be parsed"() {
given:
buildFile << """
repositories.clear()
repositories {
ivy {
url "${ivyRepo.uri}"
}
}
dependencies {
compile 'group:projectA:1.2'
}
"""
and:
def module = ivyRepo.module('group', 'projectA', '1.2').publish()
module.ivyFile.text = ""
when:
fails "showBroken"
then:
failure
.assertResolutionFailure(":compile")
.assertHasCause("Could not parse Ivy file ${module.ivyFile}")
.assertHasCause("invalid version null")
}
def "reports Ivy descriptor with configuration that extends unknown configuration"() {
given:
buildFile << """
dependencies {
compile 'group:projectA:1.2'
}
"""
and:
def module = ivyHttpRepo.module('group', 'projectA', '1.2').configuration('conf', extendsFrom: ['unknown']).publish()
when:
module.ivy.expectGet()
then:
fails "showBroken"
failure
.assertResolutionFailure(":compile")
.assertHasCause("Could not parse Ivy file ${module.ivy.uri}")
.assertHasCause("Configuration 'conf' extends configuration 'unknown' which is not declared.")
}
def "reports Ivy descriptor with artifact mapped to unknown configuration"() {
given:
buildFile << """
dependencies {
compile 'group:projectA:1.2'
}
"""
and:
def module = ivyHttpRepo.module('group', 'projectA', '1.2').artifact(conf: 'default,unknown').publish()
when:
module.ivy.expectGet()
then:
fails "showBroken"
failure
.assertResolutionFailure(":compile")
.assertHasCause("Could not parse Ivy file ${module.ivy.uri}")
.assertHasCause("Artifact projectA.jar is mapped to configuration 'unknown' which is not declared.")
}
def "reports missing parent descriptor"() {
given:
buildFile << """
dependencies {
compile 'group:projectA:1.2'
}
"""
and:
def parent = ivyHttpRepo.module('group', 'parent', 'a')
def module = ivyHttpRepo.module('group', 'projectA', '1.2').extendsFrom(organisation: 'group', module: 'parent', revision: 'a').publish()
when:
module.ivy.expectGet()
parent.ivy.expectGetMissing()
then:
fails "showBroken"
failure
.assertResolutionFailure(":compile")
.assertHasCause("Could not parse Ivy file ${module.ivy.uri}")
.assertHasCause("""Could not find group:parent:a.
Searched in the following locations:
- ${parent.ivy.uri}""")
}
def "reports parent descriptor that cannot be parsed"() {
given:
buildFile << """
dependencies {
compile 'group:projectA:1.2'
}
"""
and:
def parent = ivyHttpRepo.module('group', 'parent', 'a').publish()
parent.ivyFile.text = ' '
def module = ivyHttpRepo.module('group', 'projectA', '1.2').extendsFrom(organisation: 'group', module: 'parent', revision: 'a').publish()
when:
module.ivy.expectGet()
parent.ivy.expectGet()
then:
fails "showBroken"
failure
.assertResolutionFailure(":compile")
.assertHasCause("Could not parse Ivy file ${module.ivy.uri}")
.assertHasCause("Could not parse Ivy file ${parent.ivy.uri}")
.assertHasCause("invalid version null")
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy