Skip to content

Commit ab7d4ea

Browse files
committed
maven publishing setup for gradle plugin with javadocs and sources
1 parent 43f8131 commit ab7d4ea

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

flapi-gradle-plugin/build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apply plugin: 'groovy'
22
apply plugin: 'maven'
3+
apply plugin: 'maven-publish'
34

45
group = 'unquietcode.tools.flapi'
56
version = '0.0-DEVELOPMENT'
@@ -14,4 +15,34 @@ dependencies {
1415
compile localGroovy()
1516

1617
compile 'unquietcode.tools.flapi:flapi-plugin:0.0-DEVELOPMENT'
18+
}
19+
20+
task sourceJar(type: Jar, dependsOn: classes) {
21+
classifier = "sources"
22+
from sourceSets.main.allJava
23+
}
24+
25+
task javadocJar(type: Jar, dependsOn: javadoc) {
26+
classifier = 'javadoc'
27+
from javadoc.destinationDir
28+
}
29+
30+
def AorB = { String a, String b ->
31+
return a != null && !a.trim().isEmpty() ? a : b;
32+
}
33+
34+
publishing {
35+
publications {
36+
mavenJava(MavenPublication) {
37+
from components.java
38+
artifact sourceJar
39+
artifact javadocJar
40+
}
41+
}
42+
43+
repositories {
44+
maven {
45+
url AorB(System.getProperty("maven.deploy.repository"), "$buildDir/repo")
46+
}
47+
}
1748
}

0 commit comments

Comments
 (0)