From 630a94209c7145b37cf685f4ac0b70599ec03695 Mon Sep 17 00:00:00 2001 From: tkrullmann Date: Tue, 3 Mar 2015 23:35:30 +0100 Subject: [PATCH] Modified build script to embed pom.xml in published JAR --- README.md | 2 +- build.gradle | 90 +++++++++++++++++++++++++++------------------------- 2 files changed, 48 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 98aab8a..13781e6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A plugin for the Gradle build system that allows specifying test sets (like inte To use the TestSets plugin, include the following lines in your build script: plugins { - id 'org.unbroken-dome.test-sets' version '1.0.0' + id 'org.unbroken-dome.test-sets' version '1.0.1' } The TestSets plugin will only work in conjunction with the `java` and/or `groovy` plugin. diff --git a/build.gradle b/build.gradle index 93c32d7..f9fffda 100644 --- a/build.gradle +++ b/build.gradle @@ -10,31 +10,66 @@ plugins { group = 'org.unbroken-dome.gradle-plugins' archivesBaseName = 'gradle-testsets-plugin' -version = '1.0.0' +version = '1.0.1' sourceCompatibility = '1.8' targetCompatibility = '1.8' -repositories { - mavenCentral() - maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } -} - - dependencies { compile gradleApi() - compile 'com.google.guava:guava:18.0' - testCompile 'org.codehaus.groovy:groovy-all:2.3.6' - testCompile 'org.spockframework:spock-core:1.0-groovy-2.3-SNAPSHOT' + testCompile ('org.spockframework:spock-core:0.7-groovy-2.0') { + exclude group: 'org.codehaus.groovy' + } testCompile 'org.hamcrest:hamcrest-all:1.3' } -configurations { - all*.exclude module: 'junit-dep' + +def pomDefinition = pom { + project { + name project.friendly_name + packaging 'jar' + description project.description + url project.home_url + + scm { + connection "scm:git:${project.scm_url}" + developerConnection "scm:git:${project.scm_url}" + url project.scm_url + } + + licenses { + license { + name = project.license_name + url project.license_url + } + } + + developers { + developer { + name 'Till Krullmann' + email 'till.krullmann@gmx.net' + } + } + } +} + + +task generatePom { + outputs.file "$buildDir/poms/pom.xml" + doLast { + pomDefinition.writeTo "$buildDir/poms/pom.xml" + } +} + + +jar { + into("META-INF/maven/$project.group/$project.name") { + from generatePom + } } @@ -67,40 +102,9 @@ eclipse.project { } -def pomDefinition = pom { - project { - name project.friendly_name - packaging 'jar' - description project.description - url project.home_url - - scm { - connection "scm:git:${project.scm_url}" - developerConnection "scm:git:${project.scm_url}" - url project.scm_url - } - - licenses { - license { - name = project.license_name - url project.license_url - } - } - - developers { - developer { - name 'Till Krullmann' - email 'till.krullmann@gmx.net' - } - } - } -} - - install { repositories.mavenInstaller { beforeDeployment { deployment -> signing.signPom(deployment) } - pom = pomDefinition } }