Enable uploading to local artifactory.
MODIFY
DEVELOPERS.md
DEVELOPERS.md
## Developer instructions
### Testing a release locally
-Run nexus locally (assuming you have docker running locally):
+Run artifactory locally (assuming you have docker running locally):
```bash
-docker run -d -p 8081:8081 --name nexus sonatype/nexus
+docker run -p 8080:8080 mattgruter/artifactory
```
-Configure the `distributionManagement` section in the root `pom.xml` to point to the repo on localhost.
+Configure the `contextUrl` section in `publish.gradle` to point to `http://localhost:8080/artifactory`.
-Add/update your `~/.m2/settings.xml` with the following config block:
+Add/update your `~/.gradle/gradle.properties` with the following config block:
-```xml
-<settings>
- <servers>
- <server>
- <id>nexus-local</id>
- <username>admin</username>
- <password>admin123</password>
- </server>
- </servers>
-</settings>
+```properties
+bintrayUser=admin
+bintrayApiKey=password
```
+Upload artifacts to the local artifactory:
+
+```bash
+./gradlew artifactoryPublish
+```
+
+
+## LEGACY BELOW PENDING UPDATE
Perform the release process as described below.

MODIFY
dd-java-agent-ittests/dd-java-agent-ittests.gradle
dd-java-agent-ittests/dd-java-agent-ittests.gradle
+apply from: "${rootDir}/gradle/java.gradle"
+
// Not adding jacoco here as it inexplicably breaks our tests.
// apply from: "${rootDir}/gradle/jacoco.gradle"

MODIFY
dd-java-agent/dd-java-agent.gradle
dd-java-agent/dd-java-agent.gradle
@@ -4,8 +4,11 @@ plugins {
description = 'dd-java-agent'
+apply from: "${rootDir}/gradle/java.gradle"
+apply from: "${rootDir}/gradle/publish.gradle"
apply from: "${rootDir}/gradle/jacoco.gradle"
-jacocoTestReport.dependsOn project(':dd-java-agent-ittests').test
+jacocoTestReport.dependsOn ':dd-java-agent-ittests:test'
+
whitelistedInstructionClasses += whitelistedBranchClasses += [
"com.datadoghq.trace.agent.integration.*",
'com.datadoghq.trace.agent.AnnotationsTracingAgent',

MODIFY
dd-trace-annotations/dd-trace-annotations.gradle
dd-trace-annotations/dd-trace-annotations.gradle
+apply from: "${rootDir}/gradle/java.gradle"
+apply from: "${rootDir}/gradle/publish.gradle"
apply from: "${rootDir}/gradle/jacoco.gradle"
description = 'dd-trace-annotations'

MODIFY
dd-trace-examples/async-tracing/async-tracing.gradle
dd-trace-examples/async-tracing/async-tracing.gradle
+apply from: "${rootDir}/gradle/java.gradle"
+apply from: "${rootDir}/gradle/jacoco.gradle"
+
description = 'async-tracing'
dependencies {
compile project(':dd-trace')

MODIFY
dd-trace-examples/dropwizard-mongo-client/dropwizard-mongo-client.gradle
dd-trace-examples/dropwizard-mongo-client/dropwizard-mongo-client.gradle
+apply from: "${rootDir}/gradle/java.gradle"
+apply from: "${rootDir}/gradle/jacoco.gradle"
+
description = 'dropwizard-mongo-client'
dependencies {
compile project(':dd-trace-annotations')

MODIFY
dd-trace-examples/spring-boot-jdbc/spring-boot-jdbc.gradle
dd-trace-examples/spring-boot-jdbc/spring-boot-jdbc.gradle
+apply from: "${rootDir}/gradle/java.gradle"
+apply from: "${rootDir}/gradle/jacoco.gradle"
+
description = 'spring-boot-jdbc'
dependencies {
compile group: 'com.h2database', name: 'h2', version: '1.4.196'

MODIFY
dd-trace-java.gradle
dd-trace-java.gradle
allprojects {
- apply plugin: 'maven'
-
group = 'com.datadoghq'
version = '0.1.2-SNAPSHOT'
}
-subprojects {
- apply plugin: 'java'
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
-
- task packageSources(type: Jar) {
- classifier = 'sources'
- from sourceSets.main.allSource
- }
- artifacts.archives packageSources
+buildscript {
repositories {
- mavenLocal()
-
- maven { url "http://repo.maven.apache.org/maven2" }
+ jcenter()
+ }
+ dependencies {
+ classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.18"
}
}

MODIFY
dd-trace/dd-trace.gradle
dd-trace/dd-trace.gradle
@@ -5,6 +5,8 @@ plugins {
description = 'dd-trace'
+apply from: "${rootDir}/gradle/java.gradle"
+apply from: "${rootDir}/gradle/publish.gradle"
apply from: "${rootDir}/gradle/jacoco.gradle"
minimumBranchCoverage = 0.3
minimumInstructionCoverage = 0.5

ADD
gradle/java.gradle
+apply plugin: 'java'
+sourceCompatibility = 1.7
+targetCompatibility = 1.7
+
+task packageSources(type: Jar) {
+ classifier = 'sources'
+ from sourceSets.main.allSource
+}
+artifacts.archives packageSources
+repositories {
+ mavenLocal()
+
+ maven { url "http://repo.maven.apache.org/maven2" }
+}

ADD
gradle/pom.gradle
+/*
+ * Copyright 2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Source: https://github.com/ratpack/ratpack/blob/master/gradle/pom.gradle
+
+ext {
+ pomModifications = []
+ modifyPom = { pomModifications << it }
+}
+
+tasks.withType(Upload) {
+ repositories.withType(org.gradle.api.artifacts.maven.MavenResolver) {
+ it.pom.whenConfigured { pom ->
+ pomModifications.each {
+ configure(pom, it)
+ }
+ }
+ }
+}
+
+modifyPom {
+ dependencies.removeAll { it.scope == "test" }
+}
+
+modifyPom {
+ project {
+ name project.name
+ description project.description
+ url "https://github.com/datadog/dd-trace-java"
+// licenses {
+// license {
+// name "The Apache Software License, Version 2.0"
+// url "http://www.apache.org/licenses/LICENSE-2.0.txt"
+// distribution "repo"
+// }
+// }
+ scm {
+ connection "scm:https://datadog@github.com/datadog/dd-trace-java"
+ developerConnection "scm:git@github.com:datadog/dd-trace-java.git"
+ url "https://github.com/datadog/dd-trace-java"
+ }
+ developers {
+ developer {
+ id "datadog"
+ name "Datadog"
+ }
+ }
+ }
+}

ADD
gradle/publish.gradle
+/*
+ * Copyright 2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Source: https://github.com/ratpack/ratpack/blob/master/gradle/publish.gradle
+
+apply plugin: 'maven'
+apply plugin: "com.jfrog.artifactory"
+apply plugin: "signing"
+apply from: "${rootDir}/gradle/pom.gradle"
+
+afterEvaluate {
+ assert description: "Project $project.path is published, must have a description"
+}
+
+tasks.withType(Upload).matching { it.name != "install" }.all {
+ rootProject.subprojects {
+ mustRunAfter tasks.matching { it instanceof VerificationTask }
+ }
+}
+
+def isSnapshot = !version.endsWith("-SNAPSHOT")
+
+//if (!isSnapshot) {
+// tasks.withType(Upload) {
+// repositories.matching { it.name == "mavenInstaller" }.all {
+// beforeDeployment { deployment ->
+// signing.signPom(deployment)
+// }
+// }
+// }
+//}
+//
+//signing {
+// if (!isSnapshot) {
+// required = true
+// sign configurations.archives
+// }
+//}
+//
+//configurations.signatures.artifacts.all {
+// extension = toSignArtifact.extension + "." + extension
+//}
+
+configurations {
+ configurations {
+ all {
+ incoming.afterResolve {
+ dependencies.withType(ModuleDependency) { dep ->
+ excludeRules.each {
+ if ([it.group, it.module].any { it == null }) {
+ throw new InvalidUserDataException(
+ "Partial exclude for dependency '$dep.group:$dep.name:$dep.version' of $project: [group: $it.group, module: $it.module]\n\nExcludes must specify both group and module and neither can be '*'."
+ )
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+javadoc {
+ source = sourceSets.main.allJava
+ classpath = configurations.compileClasspath
+
+ options {
+ setMemberLevel JavadocMemberLevel.PUBLIC
+ setAuthor true
+
+ links "https://docs.oracle.com/javase/8/docs/api/"
+ }
+}
+
+task sourceJar(type: Jar) {
+ from sourceSets.main.allJava
+ classifier = 'sources'
+}
+
+task javaDocJar(type: Jar, dependsOn: javadoc) {
+ from javadoc.destinationDir
+ classifier = 'javadoc'
+}
+
+artifacts {
+ archives jar
+ archives sourceJar
+ archives javaDocJar
+}
+
+artifactoryPublish { task ->
+ artifactory {
+ publish {
+ contextUrl = 'http://localhost:8080/artifactory'
+ repository {
+ repoKey = !isSnapshot ? 'libs-snapshot-local' : 'libs-release-local'
+// repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
+ gradle.taskGraph.whenReady { taskGraph ->
+ if (taskGraph.hasTask(task)) {
+ username = bintrayUser
+ password = bintrayApiKey
+ }
+ }
+ }
+ defaults {
+ publishConfigs('archives')
+ publishIvy = false
+ }
+ }
+ }
+}

Enable uploading to local artifactory.