Skip to content

Commit 3256bd3

Browse files
committed
Migrate to io.github.gradle-nexus.publish-plugin
1 parent 300e6a8 commit 3256bd3

File tree

5 files changed

+95
-40
lines changed

5 files changed

+95
-40
lines changed

build.gradle

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1+
plugins {
2+
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
3+
id "maven-publish"
4+
id "signing"
5+
}
6+
7+
group = GROUP
8+
version = VERSION_NAME
9+
10+
nexusPublishing {
11+
repositories {
12+
sonatype {
13+
username = project.findProperty("SONATYPE_NEXUS_USERNAME")
14+
password = project.findProperty("SONATYPE_NEXUS_PASSWORD")
15+
}
16+
}
17+
}
18+
119
subprojects {
220
repositories {
3-
jcenter()
21+
mavenCentral()
422
}
523
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
java {
2+
withJavadocJar()
3+
withSourcesJar()
4+
}
5+
6+
publishing {
7+
publications {
8+
maven(MavenPublication) {
9+
from(components.java)
10+
11+
pom {
12+
groupId = GROUP
13+
artifactId = POM_ARTIFACT_ID
14+
version = VERSION_NAME
15+
16+
name = POM_NAME
17+
description = POM_DESCRIPTION
18+
url = POM_URL
19+
licenses {
20+
license {
21+
name = POM_LICENCE_NAME
22+
url = POM_LICENCE_URL
23+
distribution = POM_LICENCE_DIST
24+
}
25+
}
26+
developers {
27+
developer {
28+
id = POM_DEVELOPER_ID
29+
name = POM_DEVELOPER_NAME
30+
}
31+
}
32+
scm {
33+
url = POM_SCM_URL
34+
connection = POM_SCM_CONNECTION
35+
developerConnection = POM_SCM_DEV_CONNECTION
36+
}
37+
}
38+
}
39+
}
40+
repositories {
41+
maven {
42+
url = layout.buildDirectory.dir('staging-deploy')
43+
}
44+
}
45+
}
46+
47+
signing {
48+
sign publishing.publications.maven
49+
}
50+
51+
def generateMavenPom = tasks.register("generateMavenPom", GenerateMavenPom) {
52+
destination = file("../pom.xml")
53+
pom = publishing.publications.maven.pom
54+
}
55+
56+
tasks.compileJava.dependsOn generateMavenPom

library/build.gradle

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
apply plugin: 'java'
1+
plugins {
2+
id "java-library"
3+
}
24
apply plugin: 'jacoco'
35

46
sourceCompatibility = 1.8
57
targetCompatibility = 1.8
68

79
dependencies {
8-
compile 'com.google.code.gson:gson:2.10.1'
9-
compile 'com.squareup.okhttp3:okhttp:4.12.0'
10-
compile 'com.squareup.okhttp3:logging-interceptor:4.12.0'
10+
api 'com.google.code.gson:gson:2.10.1'
11+
api 'com.squareup.okhttp3:okhttp:4.12.0'
12+
api 'com.squareup.okhttp3:logging-interceptor:4.12.0'
1113

12-
testCompile 'junit:junit:4.13.1'
13-
testCompile 'nl.jqno.equalsverifier:equalsverifier:3.1.13'
14-
testCompile 'org.reflections:reflections:0.9.12'
14+
testImplementation 'junit:junit:4.13.1'
15+
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.13'
16+
testImplementation 'org.reflections:reflections:0.9.12'
1517
}
1618

1719
jar {
@@ -47,7 +49,6 @@ tasks.withType(Test).configureEach {
4749
}
4850
}
4951

50-
5152
tasks.register('prTest', Test) {
5253
// TODO move "functional" tests into specific dir and exclude it
5354
exclude '**/Base64Test.class'
@@ -57,10 +58,4 @@ tasks.register('prTest', Test) {
5758
exclude '**/UpdatesListenerTest.class'
5859
}
5960

60-
task fatJar(type: Jar) {
61-
baseName = rootProject.name + '-full'
62-
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
63-
with jar
64-
}
65-
66-
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
61+
apply from: rootProject.file('gradle/gradle-publish-plugin.gradle')

pom.xml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<!-- This module was also published with a richer model, Gradle metadata, -->
5+
<!-- which should be used instead. Do not delete the following line which -->
6+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
7+
<!-- that they should prefer consuming it instead. -->
8+
<!-- do_not_remove: published-with-gradle-metadata -->
49
<modelVersion>4.0.0</modelVersion>
510
<groupId>com.github.pengrad</groupId>
611
<artifactId>java-telegram-bot-api</artifactId>
@@ -45,23 +50,5 @@
4550
<version>4.12.0</version>
4651
<scope>compile</scope>
4752
</dependency>
48-
<dependency>
49-
<groupId>junit</groupId>
50-
<artifactId>junit</artifactId>
51-
<version>4.13.1</version>
52-
<scope>test</scope>
53-
</dependency>
54-
<dependency>
55-
<groupId>nl.jqno.equalsverifier</groupId>
56-
<artifactId>equalsverifier</artifactId>
57-
<version>3.1.13</version>
58-
<scope>test</scope>
59-
</dependency>
60-
<dependency>
61-
<groupId>org.reflections</groupId>
62-
<artifactId>reflections</artifactId>
63-
<version>0.9.12</version>
64-
<scope>test</scope>
65-
</dependency>
6653
</dependencies>
6754
</project>

sample/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ compileJava {
88
}
99

1010
repositories {
11-
jcenter()
11+
mavenCentral()
1212
}
1313

1414
dependencies {
15-
compile project(':library')
16-
17-
compile 'com.sparkjava:spark-core:2.2'
18-
compile 'org.jsoup:jsoup:1.8.3'
19-
compile 'io.reactivex:rxjava:1.0.16'
15+
implementation project(':library')
16+
implementation 'com.sparkjava:spark-core:2.2'
17+
implementation 'org.jsoup:jsoup:1.8.3'
18+
implementation 'io.reactivex:rxjava:1.0.16'
2019
}

0 commit comments

Comments
 (0)