can someone explain ``` System.getenv("JRS_S3_URI...
# gradle
x
can someone explain
Copy code
System.getenv("JRS_S3_URI")?.let {
    val sourcesJar by tasks.creating(Jar::class) {
        classifier = "sources"
        from(java.sourceSets["main"].allSource)
    }

    publishing {
        repositories {
            maven {
                url = uri(it)
                credentials(AwsCredentials::class.java) {
                    accessKey = System.getenv("JRS_ACCESSKEYID")
                    secretKey = System.getenv("JRS_SECRETACCESSKEY")
                }
            }
        }
        (publications) {
            "mavenJava"(MavenPublication::class) {
                from(components["java"])
                artifact(sourcesJar)
            }
        }
    }
}
from the gradle version? I don't get why it's
AwsCredentials::class.java
or even what the java is at all, or why publications is
Copy code
(publications) {
"mavenJava"(MavenPublication::class) {
like literally If I hadn't copied it, I would never have figured it out from what I had
e
The `credentials(..)`[1] function accept subtypes of `Credentials`[2], in this case you want the AWS implementation. This should be discoverable from the IDE by looking at javadocs or navigating to sources. [1] https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/repositories/AuthenticationSupported.html#credentials-java.lang.Class-org.gradle.api.Action- [2] https://docs.gradle.org/current/javadoc/org/gradle/api/credentials/Credentials.html
re:
(publications)
, this is a workaround for an existing issue, see https://github.com/gradle/kotlin-dsl/issues/459