apply plugin: 'maven-publish' apply plugin: 'com.jfrog.artifactory' apply plugin: 'com.jfrog.bintray' publishing { repositories { maven { url = "$rootDir/build/repo" } } publications { maven(MavenPublication) { if (project.tasks.findByName("shadowJar") != null && !findProperty('noShadowPublish')) { project.shadow.component(it) //These two are here just to satisfy Maven Central artifact sourcesJar artifact javadocJar } else { from components.java } afterEvaluate { def mavenGroupId = project.findProperty('mavenGroupId') if (mavenGroupId) { groupId = mavenGroupId } artifactId = artifactPrefix(project, archivesBaseName) + archivesBaseName if (!groupId.startsWith("io.opentelemetry.")) { throw new GradleException("groupId is not set for this project or its parent $project.parent") } } pom { name = 'OpenTelemetry Instrumentation for Java' packaging = 'jar' url = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation' licenses { license { name = 'The Apache License, Version 2.0' url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id = 'opentelemetry' name = 'OpenTelemetry Gitter' url = 'https://gitter.im/open-telemetry/opentelemetry-java-instrumentation' } } scm { connection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java-instrumentation.git' developerConnection = 'scm:git:git@github.com:open-telemetry/opentelemetry-java-instrumentation.git' url = 'git@github.com:open-telemetry/opentelemetry-java-instrumentation.git' } afterEvaluate { // description is not available until evaluated. description = project.description } } } } } private String artifactPrefix(Project p, String archivesBaseName) { if (archivesBaseName.startsWith("opentelemetry")) { return '' } if (p.name.startsWith("opentelemetry")) { return '' } if (p.name.startsWith("javaagent")) { return 'opentelemetry-' } if (p.group == 'io.opentelemetry.javaagent.instrumentation') { return 'opentelemetry-javaagent-' } return 'opentelemetry-' } bintray { user = System.getenv('BINTRAY_USER') key = System.getenv('BINTRAY_API_KEY') publications = ['maven'] publish = false pkg { repo = 'maven' name = 'opentelemetry-java-instrumentation' licenses = ['Apache-2.0'] websiteUrl = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation' issueTrackerUrl = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues' vcsUrl = 'https://github.com/open-telemetry/opentelemetry-java-instrumentation.git' userOrg = 'open-telemetry' githubRepo = 'open-telemetry/opentelemetry-java-instrumentation' version { name = project.version released = new Date() gpg { sign = true } mavenCentralSync { user = System.getenv("SONATYPE_USER") password = System.getenv("SONATYPE_KEY") } } } } bintrayUpload.enabled = !version.toString().contains('SNAPSHOT') // Snapshot publishing. artifactory { contextUrl = 'https://oss.jfrog.org' publish { repository { repoKey = 'oss-snapshot-local' username = System.getenv("BINTRAY_USER") password = System.getenv("BINTRAY_API_KEY") } } } artifactoryPublish { enabled = version.toString().contains('SNAPSHOT') publications('maven') }