Created
May 15, 2015 06:50
-
-
Save zedar/0717cd475e49d969aa3c to your computer and use it in GitHub Desktop.
Gradle template for custom ratpack module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --------------------------------------------------------------------------------------------------------------------- | |
// module build and dependencies | |
// --------------------------------------------------------------------------------------------------------------------- | |
apply plugin: "java" | |
apply plugin: "idea" | |
apply plugin: "maven-publish" | |
if (!JavaVersion.current().java6Compatible) { | |
throw new IllegalStateException("Must be built at least with Java 8") | |
} | |
sourceCompatibility = 1.8 | |
targetCompatibility = 1.8 | |
group = "o4m.ratpack-modules" | |
version = "0.1-SNAPSHOT" | |
repositories { | |
jcenter() | |
} | |
def ratpackVersion = "0.9.16" | |
dependencies { | |
compile "io.ratpack:ratpack-core:${ratpackVersion}" | |
compile "io.ratpack:ratpack-guice:${ratpackVersion}" | |
compile 'org.slf4j:slf4j-api:1.7.12' | |
testCompile 'junit:junit:4.12' | |
} | |
idea { | |
project { | |
languageLevel "1.8" | |
} | |
} | |
// --------------------------------------------------------------------------------------------------------------------- | |
// maven repository publication | |
// --------------------------------------------------------------------------------------------------------------------- | |
def moduleInfo = [ | |
description: "Ratpack module description", | |
url: "https://github.com/...", | |
issues: "https://github.com/.../issues", | |
tags: ["ratpack", "module"], | |
scm: [ | |
url: "[email protected]/....git", | |
mavenUrl: "scm:[email protected]:....git" | |
], | |
license: [ | |
shortName: "Apache-2.0", | |
fullName: "The Apache Software License, Version 2.0", | |
url: "http://www.apache.org/licenses/LICENSE-2.0.txt" | |
] | |
] | |
task sourceJar(type: Jar) { | |
from sourceSets.main.allSource | |
classifier "sources" | |
} | |
task javadocJar(type: Jar, dependsOn: javadoc) { | |
from javadoc.destinationDir | |
classifier "javadoc" | |
} | |
publishing { | |
publications { | |
mavenJava(MavenPublication) { | |
from components.java | |
artifact sourceJar | |
artifact javadocJar | |
pom.withXml { | |
asNode().children().last() + { | |
resolveStrategy = Closure.DELEGATE_FIRST // change closure resolver so first th delegate (not the owner) is used. | |
name project.name | |
description moduleInfo.description | |
url moduleInfo.url | |
scm { | |
connection moduleInfo.scm.mavenUrl | |
developerConnection moduleInfo.scm.mavenUrl | |
url moduleInfo.scm.url | |
} | |
licenses { | |
license { | |
name moduleInfo.license.fullName | |
url moduleInfo.license.url | |
} | |
} | |
// List of core committers | |
developers { | |
if (project.hasProperty("developerName")) { | |
developer { | |
name developerName | |
email developerEmail | |
organization developerOrganization | |
organizationUrl developerOrganizationUrl | |
} | |
} | |
} | |
// List of contributors | |
contributors { | |
} | |
} | |
} | |
} | |
} | |
repositories { | |
maven { | |
url "$buildDir/repo" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment