Configuration.resolve() uses local maven repo but fails to download from configured remote repo

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()}")
}

}

Very Strange it seems removal of the following from my build script “fixes” the problem. So, it looks like ssl is the real problem but my repo is http not https. I guess I need to learn more about cacerts

test {
systemProperty “javax.net.ssl.trustStore”,“${rootProject.projectDir}/myco.cacerts”
}

Found the problems

  1. In my unit test I declared mavenLocal() before my repository. Gradle properly followed the order I set.
  2. http vs https. no idea, but I added a cert and ssl option to my internal repo and added that to my trustStore.