Skip to content

Instantly share code, notes, and snippets.

@jeusdi
Created January 27, 2017 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeusdi/fddccbee40d30f1d4181de42d0da0f2c to your computer and use it in GitHub Desktop.
Save jeusdi/fddccbee40d30f1d4181de42d0da0f2c to your computer and use it in GitHub Desktop.
plugins {
id 'java'
id 'war'
id 'net.nemerosa.versioning' version '2.5.1'
id 'eclipse'
id 'eclipse-wtp'
id 'com.bmuschko.cargo-base' version '2.2.3'
}
eclipse {
project {
name = 'Commty Service Platform'
natures 'org.eclipse.buildship.core.gradleprojectnature'
}
classpath {
downloadSources = true
downloadJavadoc = true
}
}
webAppDirName = 'WebContent'
group = 'com.living'
version = versioning.info.display
repositories {
mavenCentral()
}
dependencies {
providedCompile group: 'javax', name: 'javaee-api', version:'7.0'
compile group: 'org.codehaus.jettison', name: 'jettison', version: '1.3.7'
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
compile group: 'org.slf4j', name:'slf4j-api', version:'1.7.12'
compile group: 'ch.qos.logback', name:'logback-classic', version:'1.1.3'
compile group: 'io.swagger', name: 'swagger-jaxrs', version: '1.5.10'
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.7.3'
compile group: 'org.elasticsearch', name: 'elasticsearch', version: '2.1.1'
compile group: 'com.stripe', name: 'stripe-java', version: '3.2.0'
compile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.4.1'
compile group: 'ma.glasnost.orika', name: 'orika-core', version: '1.5.0'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'
compile group: 'com.sendgrid', name:'sendgrid-java', version: '3.1.0'
cargo 'org.wildfly:wildfly-controller-client:8.2.0.Final'
cargo 'org.codehaus.cargo:cargo-core-uberjar:1.6.2'
cargo 'org.glassfish.deployment:deployment-client:3.1.1'
cargo 'org.codehaus.cargo:cargo-ant:1.6.2'
}
war {
archiveName "commty-${versioning.info.display}.war"
webInf { from 'src/main/resources/WEB-INF' }
manifest {
attributes 'Implementation-Version': versioning.info.display
}
}
task createDevelopmentWar(type: War, dependsOn: classes) {
//archiveName "commty-${versioning.info.display}.war"
destinationDir = file("$buildDir/dists")
webInf {
from('scopes') {
include 'configuration.development.properties'
rename('configuration.development.properties', 'scope.properties')
into('classes/')
}
}
}
task createQAWar(type: War, dependsOn: classes) {
//archiveName "commty-qa-${versioning.info.display}.war"
destinationDir = file("$buildDir/dists")
webInf {
from('scopes') {
include 'configuration.testing.properties'
rename('configuration.testing.properties', 'scope.properties')
into 'classes/'
}
}
}
task createProductionWar(type: War, dependsOn: classes) {
//archiveName "commty-prod-${versioning.info.display}.war"
destinationDir = file("$buildDir/dists")
webInf {
from('scopes') {
include 'configuration.production.properties'
rename('configuration.production.properties', 'scope.properties')
into 'classes/'
}
}
}
task createDists(dependsOn: [createDevelopmentWar, createQAWar, createProductionWar])
class RemoteContainer {
String name
String container
String hostname
Integer port
String username
String password
String purpose
}
def remoteContainers = [
new RemoteContainer(
name: 'wildfly10',
container: 'wildfly10x',
hostname: 'localhost',
port: 2200,
username: '---',
password: '----',
purpose: 'development'
)
]
remoteContainers.each { config ->
task "deployDev${config.name.capitalize()}"(type: com.bmuschko.gradle.cargo.tasks.remote.CargoDeployRemote) {
description = "Deploys WAR to remote Web Application Server: '${config.name}'."
containerId = config.container
hostname = config.hostname
port = config.port
username = config.username
password = config.password
context = "webapi"
dependsOn = [createDevelopmentWar]
deployables = [new com.bmuschko.gradle.cargo.convention.Deployable(file: createDevelopmentWar.archivePath)]
}
task "undeployDev${config.name.capitalize()}"(type: com.bmuschko.gradle.cargo.tasks.remote.CargoUndeployRemote) {
description = "Deploys WAR to remote Web Application Server: '${config.name}'."
containerId = config.container
hostname = config.hostname
port = config.port
username = config.username
password = config.password
}
}
manifest {
attributes 'Implementation-Title': 'Living-Digital Commty Service Platform'
}
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment