From c3d95d8e630423f2ef18e8cd42f18276edeeab15 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 22 Jan 2017 20:37:05 +0100 Subject: [PATCH] Publishin javadoc, sources, jar and war files from gradle --- SpringJava/Gradle/build.gradle | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/SpringJava/Gradle/build.gradle b/SpringJava/Gradle/build.gradle index 8493ff3..73fc112 100644 --- a/SpringJava/Gradle/build.gradle +++ b/SpringJava/Gradle/build.gradle @@ -52,6 +52,7 @@ subprojects { apply plugin: 'jacoco' apply plugin: 'eclipse' apply plugin: 'idea' + apply plugin: 'maven-publish' group 'de.spring.jpa' version '1.0-SNAPSHOT' @@ -65,6 +66,50 @@ subprojects { maven { url 'https://dl.bintray.com/palantir/releases' } } + + task javadocJar(type: Jar) { + from javadoc + classifier 'javadoc' + } + + task sourceJar(type: Jar) { + from sourceSets.main.java + classifier 'sources' + } + + publishing { + publications { + mavenJava(MavenPublication) { + if (plugins.withType(WarPlugin)) { + from components.web + } else { + from components.java + } + + artifact sourceJar { + classifier 'sources' + } + artifact javadocJar { + classifier 'javadoc' + } + } + } + repositories { + maven { + credentials { + username project.artifactory_username + password project.artifactory_password + } + + if(project.version.endsWith('-SNAPSHOT')) { + url 'http://artifactory/artifactory/libs-snapshot-local' + } else { + url 'http://artifactory/artifactory/libs-release-local' + } + } + } + } + dependencies { // 1/3 Required dependency for log4j 2 with slf4j: binding between log4j2 and slf4j compile("org.apache.logging.log4j:log4j-slf4j-impl:${slf4jVersion}") -- 2.1.4