how to create test jar in gradle 6

Viewed 97

In Gradle 4 the following worked for creating a test .jar:

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
            artifact sourcesJar {
                classifier "sources"
            }
            artifact testJar {
                classifier "tests"
            }
        }
    }
}

Updating to Gradle 6 that no longer seems to work - the documentation suggests the following for creating a .jar:

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java

            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
        }
    }
}

When I use that I no longer get a test .jar - what is the new syntax to do that?

0 Answers
Related