11plugins {
22 kotlin(" jvm" ) version " 1.9.20"
3+ `maven- publish`
4+ `signing`
35}
46
57group = " io.github.cdsap"
6- version = " 0.1.0 "
8+ version = " 0.1.5 "
79
810dependencies {
911 testImplementation(platform(" org.junit:junit-bom:5.9.1" ))
@@ -13,3 +15,82 @@ dependencies {
1315tasks.test {
1416 useJUnitPlatform()
1517}
18+
19+ configure<JavaPluginExtension > {
20+ withJavadocJar()
21+ withSourcesJar()
22+ }
23+
24+ publishing {
25+ repositories {
26+ maven {
27+ name = " Snapshots"
28+ url = uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" )
29+
30+ credentials {
31+ username = System .getenv(" USERNAME_SNAPSHOT" )
32+ password = System .getenv(" PASSWORD_SNAPSHOT" )
33+ }
34+ }
35+ maven {
36+ name = " Release"
37+ url = uri(" https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" )
38+
39+ credentials {
40+ username = System .getenv(" USERNAME_SNAPSHOT" )
41+ password = System .getenv(" PASSWORD_SNAPSHOT" )
42+ }
43+ }
44+ }
45+ publications {
46+ create<MavenPublication >(" libPublication" ) {
47+ from(components[" java" ])
48+ artifactId = " projectgenerator"
49+ versionMapping {
50+ usage(" java-api" ) {
51+ fromResolutionOf(" runtimeClasspath" )
52+ }
53+ usage(" java-runtime" ) {
54+ fromResolutionResult()
55+ }
56+ }
57+ pom {
58+ scm {
59+ connection.set(" scm:git:git://github.com/cdsap/ProjectGenerator/" )
60+ url.set(" https://github.com/cdsap/ProjectGenerator/" )
61+ }
62+ name.set(" projectgenerator" )
63+ url.set(" https://github.com/cdsap/ProjectGenerator/" )
64+ description.set(
65+ " Returns graph metrics by project"
66+ )
67+ licenses {
68+ license {
69+ name.set(" The MIT License (MIT)" )
70+ url.set(" https://opensource.org/licenses/MIT" )
71+ distribution.set(" repo" )
72+ }
73+ }
74+ developers {
75+ developer {
76+ id.set(" cdsap" )
77+ name.set(" Inaki Villar" )
78+ }
79+ }
80+ }
81+ }
82+ }
83+ }
84+
85+ if (extra.has(" signing.keyId" )) {
86+ afterEvaluate {
87+ configure<SigningExtension > {
88+ (
89+ extensions.getByName(" publishing" ) as
90+ PublishingExtension
91+ ).publications.forEach {
92+ sign(it)
93+ }
94+ }
95+ }
96+ }
0 commit comments