Gradle 1.12 tries to resolve custom packaging with .jar extension

(Max Bruchmann) #1


I have a plugin that generates custom artifacts (.zip) and uploads them via maven to a nexus repository.

When I upgrade to gradle 1.12 I get errors when the plugin tries to find the artificats.

Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ArtifactNotFoundException: Artifact '<group>:<name>:<version>:<name>.jar' not found.

I debugged a bit and found out that the jar extension is mentioned in the cache

    <artifact name="jquery-no-conflict-with-ui" type="zip" ext="jar" conf="master"/>

Any idea where to tell gradle how to resolve the configurations with zip extension?

Thanks in advance

(Peter Niederwieser) #2

Can you show the dependency declaration? Also, can you double-check that this problem exists with 1.12 but not 1.11?

(Max Bruchmann) #3

hey so the problem occures as soon as I set the

gradleVersion from “1.11” to “1.12” and run the wrapper task ( wrapper task runs successfully) but the tasks I execute afterwards fail.

The dependencies are defined like this:

dependencies {
 webbundle "group:name:version"

webbundle is defined by my applied plugin: in the apply method:

project.configurations {
   testWebbundle { extendsFrom webbundle }

there is also a conf2scopeMapping

if (project.plugins.hasPlugin(MavenPlugin)) {
   project.conf2ScopeMappings.addMapping(500, project.configurations.webbundle, "webbundle")

The point where the plugin accesses the dependencies usually looks like this:

ResolvedComponentResult module = configuration.incoming.resolutionResult.root
  for(Dependency d : module.dependencies){

Should I use @zip in the dependencies? but then I got the feeling the transitive dependencies are not being resolved or should I set the type/ext for the configuration somewhere explicitly? I guess I also could go for JARing it but since it does not contain a META-INF nor classes I thought that would be wrong.

Running the dependencies task with 1.12 still seems to work.

(Peter Niederwieser) #4

Can you show the code involved in publishing the zip? Perhaps the problem is on the publishing side.

(Max Bruchmann) #5

For publishing I use the “maven” plugin

project.apply plugin: 'maven'

The Archive task looks like this.

def assembleWebbundleTask = project.task("assembleWebbundle", type: Zip) {
   from(taskX) { into "x/" }
 from(taskY) { into "y/" }
 from(taskZ) { into "z/" }
 from onMoreFileGeneratingTask
project.artifacts { archives assembleWebbundleTask }

The generated build/poms/pom-default.xml



and the other dependencies


(Peter Niederwieser) #6

Raised GRADLE-3081. If you can provide a self-contained reproducible example, this would be very helpful.

(Max Bruchmann) #7

Ok I try to create an example

(Max Bruchmann) #8

Hi I build an self contained example here:

One thing I stated wrong in my initial problem description the error does NOT come when I loop through

ResolvedComponentResult module = configuration.incoming.resolutionResult.root
for(Dependency d : module.dependencies){

but when I try to access files via resolvedConfiguration.resolvedArtifacts like this:

myZipConf.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact resolvedArtifact ->
                  println "$"
                project.zipTree(resolvedArtifact.file).each { file ->
                    println "\t$file content: "
                    println file.text