This message was deleted.
# community-support
s
This message was deleted.
e
What files are supposed to be copied? Typically there is no copying involved.
e
I'm trying to copy the lib artifacts from an includebuild.
I'll post more in a bit. A meeting is starting up.
Our main project is a java bytecode modifier and part of the test-suite pulls in test artifacts from other projects. I've been using custom variants to make java19 and java8 versions of the libraries (jars that we are testing on). This has worked up until trying to get a java8 SpringBoot variant. I followed the same recipe I used for making a java8 version for libraries and applied it to the SpringBoot bootJar builds but there appears to be some sort of conflict between the two artifacts when I try and pull them into the main project one after the other.
This is the configuration in the producer:
Copy code
configurations {
    fatBoot {
        canBeConsumed = true
        canBeResolved = false
        attributes {
            attribute(Attribute.of("is.springboot", String), 'true')
        }
    }
    fatBootJava8 {
        canBeConsumed = true
        canBeResolved = false
        attributes {
            attribute(Attribute.of("is.springbootjava8", String), 'true')
        }
    }
}

...

artifacts {
    fatBoot(bootJar.archivePath) {
        builtBy(bootJar)
    }
    fatBootJava8 jarJava8
}
the artifacts are built correctly within this producer project
the consumer
Copy code
configurations {
    testInputSpringBootJars {
        attributes {
            attribute(Attribute.of("is.springboot", String), 'true')
        }
    }
    testInputSpringBootJava8Jars {
        attributes {
            attribute(Attribute.of("is.springbootjava8", String), 'true')
        }
    }
}

...
dependencies {
  testInputSpringBootJars "com.pjrcorp:SpringBoot:+@jar"
  testInputSpringBootJava8Jars "com.pjrcorp:SpringBoot:+@jar:java8"
}
...
task copySpringBootJars(type: Copy) {
    from configurations.testInputSpringBootJars
    into sourceSets.test.output.resourcesDir
}
task copySpringBootJava8Jars(type: Copy) {
    from configurations.testInputSpringBootJava8Jars
    into sourceSets.test.output.resourcesDir
}
running console plain I see the following when trying a build which
dependsOn
both of those tasks:
Copy code
> Task :copySpringBootJars NO-SOURCE
> Task :copySpringBootJava8Jars
running
gradle copySpringBootJars
it copies what I expect over
that's all I got, although I'll still be working on this
looking through
--info
it seems like the non-java8 version is hardly being addressed at all, I'm not sure why there is a collision
If I comment out the
dependsOn copySpringBootJava8Jars
then the non-java8 version is built and copied over ... it seems like, somehow, both tasks are able to satisfy the other (?) so only one is run ... just guessing here
printing out the contents of the configurations I see that the expected artifacts are correct, so it's like the build itself is not being kicked off
I think I might know what it is ... both of the artifacts are built by the bootJar task, with different configurations ... maybe gradle thinks it only needs to be run once?
I can't figure out how to get the bootJar task to run more than once, i.e. not collapsing into one run
I did it by making a dummy bootJarN task
Copy code
tasks.register("bootJarN", BootJar.class) {
    group = bootJar.group
    description = bootJar.description
    classpath = bootJar.classpath
    mainClass = bootJar.mainClass
}