Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81cea6c

Browse files
authored
Publish to Sonatype / Maven Central (#40)
* Add sonatype code to build.gradle * Make README point to Maven Central * Move to env vars, replace my name with Serverless team
1 parent 47ba57c commit 81cea6c

File tree

2 files changed

+73
-27
lines changed

2 files changed

+73
-27
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
44
[![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-java/blob/main/LICENSE)
55
![](https://github.com/DataDog/datadog-lambda-java/workflows/Test%20on%20Master%20branch/badge.svg)
6-
![Bintray](https://img.shields.io/bintray/v/datadog/datadog-maven/datadog-lambda-java)
6+
![Maven Central](https://img.shields.io/maven-central/v/com.datadoghq/datadog-lambda-java)
77

88
The Datadog Lambda Java Client Library for Java (8 and 11) enables [enhanced lambda metrics](https://docs.datadoghq.com/integrations/amazon_lambda/?tab=awsconsole#real-time-enhanced-lambda-metrics)
99
and [distributed tracing](https://docs.datadoghq.com/integrations/amazon_lambda/?tab=awsconsole#tracing-with-datadog-apm)
@@ -14,7 +14,7 @@ to the Datadog API.
1414

1515
## Installation
1616

17-
This library will be distributed through JFrog [Bintray](https://bintray.com/beta/#/datadog/datadog-maven/datadog-lambda-java).
17+
This library will be distributed through [Maven Central](https://search.maven.org/artifact/com.datadoghq/datadog-lambda-java).
1818
Follow the [installation instructions](https://docs.datadoghq.com/serverless/installation/java/), and view your function's enhanced metrics, traces and logs in Datadog.
1919

2020
## Environment Variables

build.gradle

+71-25
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ plugins {
1010
// Apply the java-library plugin to add support for Java Library
1111
id 'java-library'
1212
id 'com.github.johnrengelman.shadow' version '5.2.0'
13-
id "com.jfrog.bintray" version "1.8.4"
1413
id("com.github.gmazzo.buildconfig") version '2.0.2'
14+
id 'signing'
15+
id 'maven'
1516
}
1617

1718
repositories {
@@ -47,14 +48,13 @@ targetCompatibility = 1.8
4748

4849
group = 'com.datadoghq'
4950
version= '0.2.3'
51+
archivesBaseName = "datadog-lambda-java"
52+
description = "datadog-lambda-java"
5053

5154
allprojects {
52-
repositories {
53-
jcenter()
54-
}
55-
apply plugin: 'maven'
56-
apply plugin: 'maven-publish'
57-
apply plugin: 'java'
55+
apply plugin: 'maven'
56+
apply plugin: 'maven-publish'
57+
apply plugin: 'java'
5858
}
5959

6060
publishing {
@@ -68,25 +68,71 @@ publishing {
6868
}
6969
}
7070

71-
bintray {
72-
user = System.getenv('BINTRAY_USER')
73-
key = System.getenv('BINTRAY_API_TOKEN')
74-
publications = ['MyPublication']
75-
pkg {
76-
repo = 'datadog-maven'
77-
name = 'datadog-lambda-java'
78-
userOrg = 'datadog'
79-
licenses = ['Apache-2.0']
80-
vcsUrl = 'https://github.com/DataDog/datadog-lambda-java.git'
81-
version {
82-
name = project.version.toString()
83-
desc = 'Datadog Lambda Java runtime library'
84-
vcsTag = project.version.toString()
85-
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
86-
}
87-
}
88-
}
8971

9072
buildConfig {
9173
buildConfigField('String', 'datadog_lambda_version', '"' + project.version.toString() + '"')
9274
}
75+
76+
77+
task javadocJar(type: Jar, dependsOn: javadoc) {
78+
classifier = 'javadoc'
79+
from javadoc
80+
}
81+
82+
task sourcesJar(type: Jar) {
83+
classifier = 'sources'
84+
from sourceSets.main.allSource
85+
}
86+
87+
artifacts {
88+
archives javadocJar, sourcesJar
89+
}
90+
91+
signing {
92+
sign configurations.archives
93+
}
94+
95+
uploadArchives {
96+
repositories {
97+
mavenDeployer {
98+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
99+
100+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
101+
authentication(userName: System.getenv('SONATYPE_USERNAME'), password: System.getenv('SONATYPE_PASSWORD'))
102+
}
103+
104+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
105+
authentication(userName: System.getenv('SONATYPE_USERNAME'), password: System.getenv('SONATYPE_PASSWORD'))
106+
}
107+
108+
pom.project {
109+
name 'Datadog Lambda Java library'
110+
packaging 'jar'
111+
// optionally artifactId can be defined here
112+
description 'A library for instrumenting your AWS Lambda functions written in Java and sending the telemetry to Datadog'
113+
url 'http://datadoghq.com'
114+
115+
scm {
116+
connection 'scm:[email protected]:DataDog/datadog-lambda-java.git'
117+
developerConnection 'scm:[email protected]:DataDog/datadog-lambda-java.git'
118+
url 'https://github.com/DataDog/datadog-lambda-java'
119+
}
120+
121+
licenses {
122+
license {
123+
name 'The Apache License, Version 2.0'
124+
url 'https://github.com/DataDog/datadog-lambda-java/blob/main/LICENSE'
125+
}
126+
}
127+
128+
developers {
129+
developer {
130+
id 'serverless'
131+
name 'Datadog Serverless Team'
132+
133+
}
134+
}
135+
}
136+
}
137+
}
138+
}

0 commit comments

Comments
 (0)