Skip to content

Instantly share code, notes, and snippets.

@rdev5 rdev5/build.gradle Secret
Last active Jul 20, 2017

Embed
What would you like to do?
On Windows, run: .\gradlew.bat clean build
apply plugin: 'org.springframework.boot'
apply from: 'http://dl.bintray.com/scalding/generic/waroverlay.gradle'
apply from: 'https://raw.githubusercontent.com/apereo/cas/5.1.x/gradle/overrides.gradle'
apply plugin: 'eclipse'
apply plugin: 'idea'
eclipse {
classpath {
downloadSources = true
downloadJavadoc = true
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
bootRepackage {
enabled = false
}
springBoot {
mainClass = "org.springframework.boot.loader.WarLauncher"
}
bootRun {
addResources = true
}
repositories {
mavenLocal()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://build.shibboleth.net/nexus/content/repositories/releases/' }
maven { url 'https://dl.bintray.com/uniconiam/maven' }
maven { url 'https://jitpack.io' }
}
dependencies {
compile "org.apereo.cas:cas-server-webapp-tomcat:${project.'cas.version'}@war"
compile "org.apereo.cas:cas-server-support-json-service-registry:${project.'cas.version'}"
compile "org.apereo.cas:cas-server-support-duo:${project.'cas.version'}"
}
task copyConfig(type: Copy) {
println "Copying configuration to /etc/cas/config"
from "${project.rootDir}/etc/cas/config"
into '/etc/cas/config'
}
war {
dependsOn copyConfig
baseName 'cas'
includeWarJars = true
entryCompression = ZipEntryCompression.STORED
manifest {
from manifestFile()
}
}
task explodeWar(type: Copy) {
group = "build"
description = "Explode the cas.war"
from zipTree(project.war.outputs.files.singleFile)
into "${buildDir}/cas"
doLast {
println "CAS web application artifact exploded into [cas/build/cas]"
}
}
File manifestFile() {
def warfile = configurations.runtime.asFileTree.matching {
include '**/*.war'
}
def manifest = zipTree(warfile.singleFile).matching {
include '**/*.MF'
}
def dst = new File("${project.rootDir}/etc/cas/MANIFEST.MF")
dst.delete()
dst << manifest.singleFile.text
return dst
}
task generateKeys {
group = 'CAS'
description = 'generate keys for CAS. These keys can be added to your application.properties file'
doLast {
println 'Generating keys for CAS...'
['cas.tgc.encryptionKey': 256, 'cas.tgc.signingKey': 512, 'cas.webflow.encryption.key': 96, 'cas.webflow.signing.key': 512].each { key, size ->
def octetKey = OctJwkGenerator.generateJwk(size)
def params = octetKey.toParams(JsonWebKey.OutputControlLevel.INCLUDE_SYMMETRIC)
println "${key}=${params.get('k')}"
}
}
}
task run {
dependsOn build
doLast{
javaexec {
main="-jar";
jvmArgs = [
"-Xmx2048M"
]
args = [
"build/libs/cas.war"
]
}
}
}
task debug {
dependsOn build
doLast {
javaexec {
main="-jar";
jvmArgs = [
"-Xmx2048M",
"-XX:+TieredCompilation",
"-XX:TieredStopAtLevel=1",
"-Xdebug",
"-Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y"
]
args = [
"build/libs/cas.war",
]
println "Started ${commandLine}"
}
}
}
cas.version=5.1.1-SNAPSHOT
##
# Only modify below this line if you know what you're doing!
##
gradle.version=3.5
sourceCompatibility=1.8
targetCompatibility=1.8
springboot.version=1.5.3.RELEASE
# For debug, increase speed when executing gradle many times
# Daemon will keep running a daemon for 3h hours on each gradle run, improves speed
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx1024M -XX:+TieredCompilation -XX:TieredStopAtLevel=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.