Created
October 27, 2017 09:59
-
-
Save witokondoria/8e14a4358b2500f30ddd9cf2a144dd39 to your computer and use it in GitHub Desktop.
A simple init.gradle close to a maven global parent pom
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
projectsEvaluated { | |
rootProject { | |
task version { | |
println project.version | |
} | |
task changeVersion { | |
ant.replaceregexp(file: "build.gradle", match: "\\sversion\\s+?=\\s+?[\"|\'](${project.version})[\"|\']", replace: " version = \"${System.getProperty('newVersion')}\"", byline: true, flags: "s") | |
} | |
task listrepos << { | |
println "Repositories:" | |
project.repositories.each { println "Name: " + it.name + "; url: " + it.url } | |
} | |
task alljavadoc(type: Javadoc) { | |
source subprojects.collect { | |
it.sourceSets.main.allJava | |
} | |
classpath = files(subprojects.collect { | |
it.sourceSets.main.compileClasspath | |
}) | |
destinationDir = file("target/site/apidocs") | |
} | |
} | |
} | |
allprojects { | |
apply plugin: 'java' | |
apply plugin: 'jacoco' | |
apply plugin: 'maven' | |
repositories { | |
mavenLocal() | |
maven { | |
url 'http://sodio.stratio.com/repository/public' | |
} | |
all { ArtifactRepository repo -> | |
if ((repo instanceof MavenArtifactRepository) && | |
!(repo.url =~ /internal/) && !(repo.url =~ /\.m2/)) { | |
remove repo | |
} | |
} | |
} | |
test() { | |
scanForTestClasses = false | |
String testType = System.properties['test.type'] | |
String jacocoName = "UT" | |
String reportPath = "surefire" | |
filter { | |
setFailOnNoMatchingTests false | |
if (testType == 'integration') { | |
includeTestsMatching "*IT" | |
jacocoName = "IT" | |
reportPath = "failsafe" | |
} else if (testType == 'unit') { | |
includeTestsMatching "*Test" | |
} | |
} | |
reports.junitXml.destination = file("target/${reportPath}-reports") | |
reports.html.enabled = false | |
jacoco { | |
append = false | |
destinationFile = file("target/jacoco${jacocoName}.exec") | |
} | |
} | |
uploadArchives { | |
repositories { | |
mavenDeployer { | |
repository(url: "http://repository/releases") { | |
authentication(userName: '', password: '') | |
} | |
snapshotRepository(url: "http://repository/snapshots") { | |
authentication(userName: '', password: '') | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment