Hi,
I have configured a remote m2 repository and have custom plugin code that adds a configuration to the project and then copies artifacts to a directory. If my local m2 repo already has the content, the copy works. If it lacks the content, then resolve doesn’t fetch it.
What am I missing about triggering the fetch and why is it using ivy when I have maven configured in my build.gradle?
Thanks
Error
org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration@25bf5ccf
of blackduck tools.
Detail: Could not resolve all dependencies for configuration ‘:blackduckConfigbomExporter’.
build.gradle
repositories {
maven {
url “http://mvn.corp.myco.com/nexus/content/groups/public”
}
mavenLocal()
}
Code
Configuration getBlackDuckConfiguration(def version) { if (!project.configurations.find { it.name == blackduckConfigurationName }) { Configuration blackduckTools = project.configurations.create(blackduckConfigurationName) blackduckTools.setVisible(true) blackduckTools.setTransitive(false)
project.dependencies.add(blackduckConfigurationName, "com.myco.releng.blackduck:${toolName}:${version}:lin64-aieDist@tar.gz") blackduckTools.resolutionStrategy.cacheDynamicVersionsFor(0, TimeUnit.SECONDS) blackduckTools.resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) blackduckTools.resolutionStrategy.force(["com.myco.releng.blackduck:${toolName}:${version}"]) } return project.configurations.getByName(blackduckConfigurationName) }
/**
Download tools from maven repository
*/
void fetchTools() {
toolsDir.getParentFile().mkdirs()
Configuration config = getBlackDuckConfiguration()// Resolve
try {
println config.resolutionStrategy.getForcedModules()
println "----------- Resolution "
def resolution = config.resolve() resolution.each { println "Retreived ${it.absolutePath}" }
project.copy { from(config) into(toolsDir.absolutePath) } } catch (ResolveException e) { throw new GradleException("Cannot locate ${blackduckConfigurationName} : ${config.resolvedConfiguration.toString()} of blackduck tools. Perhaps they are missing from nexus or purge?. Detail: ${e.getMessage()}") }
}