Created
August 15, 2013 14:26
-
-
Save ae6rt/6241247 to your computer and use it in GitHub Desktop.
Gradle build config for publishing artifact with source code to a Maven repository.
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
apply plugin: 'java' | |
apply plugin: 'maven-publish' | |
group = "org.petrovic" | |
version = "0.2" | |
ext.versions = [ | |
logback: "1.0.13", | |
junit: "4.11", | |
hamcrest: "1.3" | |
] | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
compile group: "ch.qos.logback", name: "logback-classic", version: versions.logback | |
testCompile group: "junit", name: "junit", version: versions.junit | |
testCompile group: "org.hamcrest", name: "hamcrest-all", version: versions.hamcrest | |
} | |
task wrapper(type: Wrapper) { | |
gradleVersion = '1.7' | |
} | |
test { | |
testLogging.showStandardStreams = true | |
} | |
tasks.withType(Compile) { | |
options.encoding = 'UTF-8' | |
} | |
tasks.withType(Test) { | |
systemProperties = System.getProperties() | |
testLogging.showStandardStreams = true | |
} | |
task sourceJar(type: Jar) { | |
from sourceSets.main.allJava | |
} | |
publishing { | |
publications { | |
mavenJava(MavenPublication) { | |
from components.java | |
artifact sourceJar { | |
classifier "source" | |
} | |
} | |
} | |
repositories { | |
maven { | |
url "https://mavenrepo.example.com" | |
credentials { | |
username = "x" | |
password = "x" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
classifier "source"
should beclassifier "sources"
.