Skip to content

Instantly share code, notes, and snippets.

@goncha
Last active Aug 29, 2015
Embed
What would you like to do?
build.gradle for SpringMVC
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'java'
project.version = "1.0"
try {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'svn'
args = ['info']
standardOutput = os
}
def outputAsString = os.toString()
def revision = outputAsString =~ /Revision: (\d+)/
project.ext.svnRevision = revision[0][1]
}
project.version = project.version + "-${svnRevision}"
} catch (Exception e) {
}
configurations {
// provided dependency for yigo artifacts
provided {
description = 'provided classpath'
transitive = true
}
compile {
extendsFrom provided
}
runtime {
exclude module: 'log4j'
}
}
repositories {
//mavenCentral()
maven {
url 'http://1.1.9.4:9000/nexus/content/groups/public'
}
}
dependencies {
compile 'org.elasticsearch:elasticsearch:1.1.0'
compile 'org.elasticsearch:elasticsearch-query-access-control-filter:1.5'
compile 'com.itextpdf:itextpdf:5.5.1'
runtime 'org.elasticsearch:elasticsearch-analysis-smartcn:2.1.0'
provided fileTree(dir: "${yigoDeploy}/WEB-INF/lib",
include: '*.jar',
excludes: ['lucene-*.jar', 'elasticsearch-*', "${project.name}*"])
provided fileTree(dir: "${yigoDeploy}/WEB-INF/lib/@deprecated", include: '*.jar' )
}
jar {
manifest {
attributes 'Implementation-Title': project.name, 'Implementation-Version': version
}
}
tasks.withType(Compile) {
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.java
}
artifacts { archives sourcesJar }
task dist(type: Zip, dependsOn: 'jar') {
into("${dist.baseName}-${dist.version}/Config") {
from('Config/') {
include '**/*'
exclude '.svn'
}
}
into("${dist.baseName}-${dist.version}/Config/Module/SCM/Java/jar/ServerJars") {
from (configurations.runtime.files - configurations.provided.files)
from jar.archivePath
}
}
task uploadDist(type: Exec, dependsOn: 'dist') {
executable = (System.getProperty('os.name') =~ '[Ww]indows' ? 'pscp' : 'scp')
args = [dist.archivePath, "root@1.1.2.154:/software/${project.name}"]
}
apply plugin: 'war'
apply plugin: 'tomcat'
apply plugin: 'java'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
println "PROJECT=" + project.name
buildscript {
repositories {
mavenCentral()
maven {
url "http://download.java.net/maven/2"
}
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.8'
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.1'
}
}
repositories { mavenCentral() }
dependencies {
def tomcatVersion = '7.0.42'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
def springVersion = '3.2.10.RELEASE'
compile "org.springframework:spring-core:${springVersion}"
compile "org.springframework:spring-webmvc:${springVersion}"
compile 'org.slf4j:slf4j-api:1.7.7'
runtime 'org.slf4j:slf4j-log4j12:1.7.7'
testCompile "org.springframework:spring-test:${springVersion}"
testCompile 'junit:junit:4.11'
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.hamcrest:hamcrest-library:1.3"
provided 'javax.servlet:javax.servlet-api:3.0.1'
}
test {
testLogging {
// Show that tests are run in the command-line output
events 'started', 'passed'
}
}
task wrapper(type: Wrapper) { gradleVersion = '1.12' }
tomcatRunWar.contextPath = ''
allprojects {
apply plugin: 'idea'
group = 'isearch'
version = '1.0-SNAPSHOT'
}
subprojects {
apply plugin: 'eclipse'
apply plugin: 'java'
repositories {
//mavenCentral()
maven {
url 'http://1.1.9.4:9000/nexus/content/groups/public'
}
}
dependencies {
testCompile "junit:junit:4.11"
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
}
project(':knowledge') {
dependencies {
compile project(':common')
compile "org.neo4j:neo4j:1.9.1"
compile "org.neo4j:neo4j-backup:1.9.1"
compile "org.neo4j:neo4j-cluster:1.9.1"
compile "org.neo4j:neo4j-com:1.9.1"
compile "org.neo4j:neo4j-consistency-check:1.9.1"
compile "org.neo4j:neo4j-cypher:1.9.1"
compile "org.neo4j:neo4j-graph-algo:1.9.1"
compile "org.neo4j:neo4j-graph-matching:1.9.1"
compile "org.neo4j:neo4j-ha:1.9.1"
compile "org.neo4j:neo4j-jmx:1.9.1"
compile "org.neo4j:neo4j-kernel:1.9.1"
compile "org.neo4j:neo4j-lucene-index:1.9.1"
compile "org.neo4j:neo4j-management:1.9.1"
compile "org.neo4j:neo4j-shell:1.9.1"
compile "org.neo4j:neo4j-udc:1.9.1"
compile "org.slf4j:slf4j-api:1.6.1"
compile "org.jboss.netty:netty:3.2.9.Final"
compile "pentaho:mondrian:3.7"
testRuntime 'mysql:mysql-connector-java:5.1.32'
}
}
project(':nlp') {
dependencies {
compile project(':common')
compile project(':knowledge')
compile "net.sf.trove4j:trove4j:3.0.3"
compile "commons-cli:commons-cli:1.2"
compile "net.sf.json-lib:json-lib:2.4:jdk15"
compile "org.fnlp:fnlp-core:2.0"
compile "org.ansj:ansj_seg:2.0.6"
compile "org.nlpcn:nlp-lang:0.2"
}
}
project(':mdx') {
dependencies {
compile project(':common')
compile project(':nlp')
compile 'com.googlecode.lambdaj:lambdaj:2.3.3'
}
}
project(':web') {
apply plugin: 'war'
configurations {
runtime {
exclude group: 'javax.servlet'
exclude group: 'xerces'
exclude group: 'org.apache.ant'
}
}
dependencies {
compile project(':common')
compile project(':nlp')
compile project(':mdx')
compile 'pentaho:mondrian:3.7'
compile 'com.fasterxml.jackson.core:jackson-core:2.4.1.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.1.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.1'
runtime 'mysql:mysql-connector-java:5.1.32'
}
task jetty(type: JettyRunWar, dependsOn: 'assemble') {
daemon = false
httpPort = 7001
contextPath = '/isearch'
webApp = new java.io.File("$project.war.archivePath")
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.12'
distributionUrl = "http://1.1.9.4:3000/pub/software/java/build/gradle-${gradleVersion}-bin.zip"
}
rootProject.name = 'isearch'
include 'common', 'knowledge', 'nlp', 'mdx', 'web'
#!/bin/sh
gradle $1 -PyigoDeploy=/home/gang/Projects/yigo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment