Skip to content

Commit b9a497b

Browse files
Add Gradle scripts / tasks for artifact deployment (#95)
* Prepare gradle deployment to sonatype snapshot * Add condition for signing * Add gradle setup for deploying artifact to sonatype
1 parent 844dc3c commit b9a497b

File tree

4 files changed

+75
-4
lines changed

4 files changed

+75
-4
lines changed

build.gradle

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
apply {
22
plugin "base"
33
plugin "java"
4-
plugin "maven-publish"
54
plugin "checkstyle"
65
plugin "jacoco"
76
plugin "idea"
@@ -18,9 +17,8 @@ repositories {
1817
}
1918

2019
sourceCompatibility = JavaVersion.VERSION_1_8
21-
group = "oi.krakens"
20+
group = "io.krakens"
2221
archivesBaseName = "java-grok"
23-
version = '0.1.9-SNAPSHOT'
2422

2523
ext {
2624
checkStyleToolVersion = "6.19"
@@ -41,6 +39,21 @@ dependencies {
4139
testCompile "com.google.guava:guava:$guavaVersion"
4240
}
4341

42+
task javadocJar(type: Jar) {
43+
classifier = 'javadoc'
44+
from javadoc
45+
}
46+
47+
task sourcesJar(type: Jar) {
48+
classifier = 'sources'
49+
from sourceSets.main.allSource
50+
}
51+
52+
// Needed to avoid including all the jar signing and sonatype setup.
53+
if (project.hasProperty("withDeployment")) {
54+
apply from: "$rootProject.projectDir/gradle/sonatype.gradle"
55+
}
56+
4457
checkstyle {
4558
configFile = file("${project.projectDir}/extra/checkstyle/checkstyle.xml")
4659
toolVersion = "$checkStyleToolVersion"

gradle/sonatype.gradle

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apply {
2+
plugin "maven"
3+
plugin "signing"
4+
}
5+
6+
artifacts {
7+
archives javadocJar, sourcesJar
8+
}
9+
10+
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
11+
signing {
12+
required { isReleaseVersion }
13+
sign configurations.archives
14+
}
15+
16+
uploadArchives {
17+
repositories {
18+
mavenDeployer {
19+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
20+
21+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
22+
authentication(userName: ossrhUsername, password: ossrhPassword)
23+
}
24+
25+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
26+
authentication(userName: ossrhUsername, password: ossrhPassword)
27+
}
28+
29+
pom.project {
30+
name 'Java Grok'
31+
packaging 'jar'
32+
description 'Java Grok is simple API that allows you to easily parse logs and other files (single line). With Java Grok, you can turn unstructured log and event data into structured data (JSON).'
33+
url 'https://github.com/thekrakken/java-grok'
34+
35+
scm {
36+
connection 'scm:git:git@github.com:thekrakken/java-grok.git'
37+
developerConnection 'scm:git:git@github.com:thekrakken/java-grok.git'
38+
url 'scm:git:git@github.com:thekrakken/java-grok.git'
39+
}
40+
41+
licenses {
42+
license {
43+
name 'The Apache License, Version 2.0'
44+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
45+
}
46+
}
47+
48+
developers {
49+
developer {
50+
id 'anthony-corbacho'
51+
name 'Anthony Corbacho'
52+
email 'manfred@sonatype.com'
53+
}
54+
}
55+
}
56+
}
57+
}
58+
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
rootProject.name = 'java-grok'
2+
version = "0.1.9-SNAPSHOT"

src/main/java/io/krakens/grok/api/Grok.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.util.regex.Pattern;
1010

1111
import io.krakens.grok.api.Converter.IConverter;
12-
import io.krakens.grok.api.exception.GrokException;
1312

1413
import org.apache.commons.lang3.StringUtils;
1514

0 commit comments

Comments
 (0)