Update to Gradle 4.1
This commit is contained in:
parent
bf49650251
commit
455e2bab90
|
@ -1,6 +1,6 @@
|
|||
buildscript {
|
||||
dependencies {
|
||||
classpath 'io.spring.gradle:spring-build-conventions:0.0.2.RELEASE'
|
||||
classpath 'io.spring.gradle:spring-build-conventions:0.0.4.BUILD-SNAPSHOT'
|
||||
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
|
||||
}
|
||||
repositories {
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
#Tue Apr 11 20:42:24 CDT 2017
|
||||
#Fri Sep 15 11:04:40 CDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
|
||||
|
|
|
@ -1,27 +1,14 @@
|
|||
apply plugin: 'io.spring.convention.spring-sample'
|
||||
apply plugin: 'war'
|
||||
apply plugin: 'jetty'
|
||||
apply plugin: 'io.spring.convention.spring-sample-war'
|
||||
|
||||
def excludeModules = ['spring-security-acl', 'jsr250-api', 'spring-jdbc', 'spring-tx']
|
||||
def keystore = "$rootDir/samples/certificates/server.jks"
|
||||
def password = 'password'
|
||||
|
||||
configurations {
|
||||
casServer
|
||||
excludeModules.each {name ->
|
||||
runtime.exclude module: name
|
||||
}
|
||||
|
||||
runtime.exclude group: 'org.aspectj'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
test.resources.exclude 'GebConfig.groovy'
|
||||
integrationTest.groovy.srcDir file('src/integration-test/groovy')
|
||||
}
|
||||
|
||||
eclipse.classpath.plusConfigurations += [configurations.integrationTestRuntime]
|
||||
|
||||
dependencies {
|
||||
compile project(':spring-security-cas')
|
||||
compile project(':spring-security-core')
|
||||
|
@ -46,81 +33,40 @@ dependencies {
|
|||
integrationTestCompile 'org.slf4j:jcl-over-slf4j'
|
||||
}
|
||||
|
||||
[project.tasks.jettyRun, project.tasks.jettyRunWar]*.configure {
|
||||
contextPath = '/cas-sample'
|
||||
def httpConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector').newInstance()
|
||||
httpConnector.port = 8080
|
||||
httpConnector.confidentialPort = 8443
|
||||
def httpsConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector').newInstance()
|
||||
httpsConnector.port = 8443
|
||||
httpsConnector.keystore = httpsConnector.truststore = keystore
|
||||
httpsConnector.keyPassword = httpsConnector.trustPassword = password
|
||||
integrationTest {
|
||||
dependsOn { casServer().tasks.appBeforeIntegrationTest }
|
||||
doFirst {
|
||||
def casServiceHost = 'localhost:' + gretty.httpsPort
|
||||
def casServerHost = 'localhost:' + casServer().gretty.httpsPort
|
||||
systemProperties['cas.server.host'] = casServerHost
|
||||
systemProperties['cas.service.host'] = casServiceHost
|
||||
systemProperties['geb.build.baseUrl'] = 'https://'+casServiceHost+'/cas-sample/'
|
||||
systemProperties['geb.build.reportsDir'] = 'build/geb-reports'
|
||||
systemProperties['jar.path'] = jar.archivePath
|
||||
systemProperties['javax.net.ssl.trustStore'] = keystore
|
||||
systemProperties['javax.net.ssl.trustStorePassword'] = password
|
||||
}
|
||||
finalizedBy { casServer().tasks.appAfterIntegrationTest }
|
||||
}
|
||||
|
||||
connectors = [httpConnector, httpsConnector]
|
||||
doFirst() {
|
||||
System.setProperty('cas.server.host', casServer().httpsHost)
|
||||
System.setProperty('cas.service.host', jettyRunWar.httpsHost)
|
||||
prepareAppServerForIntegrationTests {
|
||||
dependsOn { casServer().tasks.appBeforeIntegrationTest }
|
||||
doLast {
|
||||
def casServiceHost = 'localhost:' + project.gretty.httpsPort
|
||||
def casServerHost = 'localhost:' + casServer().gretty.httpsPort
|
||||
gretty.jvmArgs += ["-Dcas.server.host=${casServerHost}", "-Dcas.service.host=${casServiceHost}"]
|
||||
}
|
||||
}
|
||||
|
||||
task cas (dependsOn: [jettyRunWar]) {
|
||||
jettyRunWar.dependsOn(':spring-security-samples-xml-casserver:casServer')
|
||||
}
|
||||
|
||||
task casServer(dependsOn: ':spring-security-samples-xml-casserver:casServer') {
|
||||
}
|
||||
|
||||
|
||||
integrationTest.dependsOn cas
|
||||
integrationTest.doFirst {
|
||||
def casServiceHost = jettyRunWar.httpsHost
|
||||
systemProperties['cas.server.host'] = casServer().httpsHost
|
||||
systemProperties['cas.service.host'] = casServiceHost
|
||||
systemProperties['geb.build.baseUrl'] = 'https://'+casServiceHost+'/cas-sample/'
|
||||
systemProperties['geb.build.reportsDir'] = 'build/geb-reports'
|
||||
systemProperties['jar.path'] = jar.archivePath
|
||||
systemProperties['javax.net.ssl.trustStore'] = keystore
|
||||
systemProperties['javax.net.ssl.trustStorePassword'] = password
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady {graph ->
|
||||
def casServer = casServer()
|
||||
[casServer,jettyRunWar]*.metaClass*.getHttpsConnector {->
|
||||
def sslSocketConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector')
|
||||
delegate.connectors.find { it in sslSocketConnClass }
|
||||
}
|
||||
[casServer,jettyRunWar]*.metaClass*.getHttpsHost {->
|
||||
"localhost:"+delegate.httpsConnector.port
|
||||
}
|
||||
jettyRunWar.metaClass.getHttpConnector {->
|
||||
def channelConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector')
|
||||
delegate.connectors.find { it in channelConnClass }
|
||||
}
|
||||
if (graph.hasTask(cas)) {
|
||||
casServer.daemon = true
|
||||
}
|
||||
if(graph.hasTask(integrationTest)) {
|
||||
tasks.getByPath(':spring-security-samples-xml-casserver:casServerOverlay').logLevel = 'ERROR'
|
||||
jettyRunWar {
|
||||
additionalRuntimeJars += file('src/integration-test/resources')
|
||||
daemon = true
|
||||
}
|
||||
|
||||
[jettyRunWar.httpConnector,jettyRunWar.httpsConnector,casServer.httpsConnector]*.metaClass*.reservePort { taskToCloseSocket ->
|
||||
def serverSocket = new ServerSocket(0)
|
||||
delegate.metaClass.serverSocket = serverSocket
|
||||
delegate.port = serverSocket.localPort
|
||||
taskToCloseSocket.doFirst {
|
||||
serverSocket.close()
|
||||
}
|
||||
}
|
||||
|
||||
[jettyRunWar.httpConnector,jettyRunWar.httpsConnector]*.reservePort(jettyRunWar)
|
||||
jettyRunWar.httpConnector.confidentialPort = jettyRunWar.httpsConnector.port
|
||||
casServer.httpsConnector.reservePort(casServer)
|
||||
}
|
||||
gretty {
|
||||
contextPath = '/cas-sample/'
|
||||
httpsEnabled = true
|
||||
httpsPort = 8443
|
||||
sslKeyStorePath = keystore
|
||||
sslKeyStorePassword = password
|
||||
jvmArgs = ["-Djavax.net.ssl.trustStore=${keystore}", "-Djavax.net.ssl.trustStorePassword=${password}"]
|
||||
}
|
||||
|
||||
def casServer() {
|
||||
tasks.getByPath(':spring-security-samples-xml-casserver:casServer')
|
||||
project(':spring-security-samples-xml-casserver')
|
||||
}
|
||||
|
|
|
@ -1,63 +1,55 @@
|
|||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
apply plugin: 'io.spring.convention.spring-sample'
|
||||
apply plugin: 'io.spring.convention.spring-sample-war'
|
||||
|
||||
def keystore = "$rootDir/samples/certificates/server.jks"
|
||||
def password = 'password'
|
||||
|
||||
configurations {
|
||||
casServer
|
||||
}
|
||||
dependencies {
|
||||
casServer "org.jasig.cas:cas-server-webapp:4.0.0@war"
|
||||
compile "org.jasig.cas:cas-server-webapp:4.0.0@war"
|
||||
compile slf4jDependencies
|
||||
}
|
||||
|
||||
task casServerOverlay(type: Sync) {
|
||||
def war = configurations.casServer.resolve().toArray()[0]
|
||||
def warName = war.name.replace('.war','-custom')
|
||||
def overlayDir = file('src/main/webapp')
|
||||
def explodedWar = file("$buildDir/tmp/${warName}")
|
||||
ext.customWar = file("$buildDir/tmp/${warName}.war")
|
||||
ext.tokens = [logLevel: 'INFO']
|
||||
project.tasks.withType(org.gradle.api.tasks.bundling.War) { war ->
|
||||
war.duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
project.tasks.war.doFirst {
|
||||
war.classpath = war.classpath.filter { !it.name.endsWith(".war") }
|
||||
|
||||
inputs.files(war, overlayDir)
|
||||
inputs.property('tokens',{tokens})
|
||||
outputs.files (customWar,explodedWar,file("$buildDir/tmp/expandedArchives"))
|
||||
|
||||
from zipTree(war)
|
||||
from (overlayDir) {
|
||||
filter(ReplaceTokens,tokens: tokens)
|
||||
}
|
||||
into explodedWar
|
||||
|
||||
doLast {
|
||||
if(customWar.exists()) {
|
||||
customWar.delete()
|
||||
war.project.configurations.runtime.each {
|
||||
if (it.name.endsWith(".war")) {
|
||||
def fileList = war.project.zipTree(it)
|
||||
war.from fileList
|
||||
}
|
||||
}
|
||||
ant.zip(destfile: customWar, baseDir: explodedWar)
|
||||
}
|
||||
}
|
||||
|
||||
casServerOverlay.metaClass.setLogLevel { level ->
|
||||
tokens['logLevel'] = level
|
||||
}
|
||||
|
||||
task casServer (type: org.gradle.api.plugins.jetty.JettyRunWar, dependsOn: 'casServerOverlay') {
|
||||
contextPath = "/cas"
|
||||
connectors = [casServer.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector').newInstance()]
|
||||
connectors[0].port = 9443
|
||||
connectors[0].keystore = connectors[0].truststore = keystore
|
||||
connectors[0].keyPassword = connectors[0].trustPassword = password
|
||||
connectors[0].wantClientAuth = true
|
||||
connectors[0].needClientAuth = false
|
||||
webApp = casServerOverlay.customWar
|
||||
|
||||
inputs.file casServerOverlay.customWar
|
||||
|
||||
doFirst() {
|
||||
System.setProperty('javax.net.ssl.trustStore', keystore)
|
||||
System.setProperty('javax.net.ssl.trustStorePassword', password)
|
||||
System.setProperty('java.naming.factory.url.pkgs','org.mortbay.naming')
|
||||
System.setProperty('java.naming.factory.initial','org.mortbay.naming.InitialContextFactory')
|
||||
project.tasks.withType(org.akhikhl.gretty.StartBaseTask).all { task ->
|
||||
task.doFirst {
|
||||
def destinationDir = project.file("$buildDir/inplaceWebapp")
|
||||
project.configurations.runtime.each { dependency ->
|
||||
if (dependency.name.endsWith(".war")) {
|
||||
def warTree = project.zipTree(dependency)
|
||||
project.copy {
|
||||
from warTree
|
||||
into destinationDir
|
||||
eachFile {
|
||||
if (it.relativePath.getFile(destinationDir).exists()) {
|
||||
it.exclude()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gretty {
|
||||
contextPath = '/cas'
|
||||
httpsEnabled = true
|
||||
httpPort = 9090
|
||||
httpsPort = 9443
|
||||
sslKeyStorePath = keystore
|
||||
sslKeyStorePassword = password
|
||||
jvmArgs = ["-Djavax.net.ssl.trustStore=${keystore}", "-Djavax.net.ssl.trustStorePassword=${password}"]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
apply plugin: 'io.spring.convention.spring-sample-war'
|
||||
|
||||
def keystore = "$rootDir/samples/certificates/server.jks"
|
||||
def password = 'password'
|
||||
|
||||
gretty {
|
||||
httpsEnabled = true
|
||||
httpsPort = 8443
|
||||
sslKeyStorePath = keystore
|
||||
sslKeyStorePassword = password
|
||||
jvmArgs = ["-Djavax.net.ssl.trustStore=${keystore}",
|
||||
"-Djavax.net.ssl.trustStorePassword=${password}",
|
||||
"-Dcas.server.host=localhost:$httpsPort",
|
||||
"-Dcas.service.host=localhost:$httpsPort"]
|
||||
}
|
||||
|
||||
farm {
|
||||
webapp ':spring-security-samples-xml-casserver'
|
||||
webapp ':spring-security-samples-xml-cassample'
|
||||
}
|
||||
|
||||
task cas(dependsOn: 'farmRunWar') {
|
||||
group 'Gretty tasks'
|
||||
description 'Run CAS Server and Sample'
|
||||
}
|
Loading…
Reference in New Issue