Repository: incubator-edgent Updated Branches: refs/heads/master fa16203b5 -> c64a1c812
add maven reop support for gradle Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/4adaaedb Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/4adaaedb Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/4adaaedb Branch: refs/heads/master Commit: 4adaaedbbd7e17e3ceb32d82787d53022723c1b5 Parents: 50df358 Author: Yaoliang Chen <[email protected]> Authored: Mon Aug 15 14:40:22 2016 +0800 Committer: Yaoliang Chen <[email protected]> Committed: Mon Aug 15 14:40:22 2016 +0800 ---------------------------------------------------------------------- build.gradle | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/4adaaedb/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 65aba44..95586ec 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,21 @@ allprojects { } } +/* SET PROJECT INFO for all artifacts */ +assert hasProperty('version') // See version in gradle.properties. +System.out.println("version=${version}") +group = 'org.apache.edgent' + +def getDate() { + if (!hasProperty('buildDate') || buildDate == null) { + ext.buildDate = new java.util.Date().format('yyyyMMddHHmm'); + } + return ext.buildDate; +} + +getDate(); + + ext { commithash = { try { @@ -47,9 +62,10 @@ ext { /* Configure subprojects */ subprojects { - + apply plugin: 'maven-publish' apply plugin: "jacoco" - + ext.artifact = project.name + if (buildFile.isFile() && !buildFile.exists()) { configurations.create('default') return @@ -133,6 +149,13 @@ subprojects { configure jarOptions } + task sourceJar(type: Jar) { + // baseName-appendix-version-classifier.extension + from sourceSets.main.allJava + classifier = 'sources' + } + + task copyJar(type: Copy) { def projectGroup = "$project.group".replace("edgent.", "") @@ -159,6 +182,22 @@ subprojects { } } + publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifactId = artifact + artifact sourceJar + //artifact javadocJar + //artifact testJar + pom.withXml { + // Example of appending more information to pom. + //asNode().appendNode('description', 'A demonstration of Maven POM customization') + } + } + } + } + copyJar.dependsOn assemble build.dependsOn copyJar } @@ -376,4 +415,4 @@ build.finalizedBy aggregateJavadoc task wrapper(type: Wrapper) { jarFile = rootProject.file('.gradle-wrapper/gradle-wrapper.jar') -} \ No newline at end of file +}
