Last active
August 29, 2015 14:01
-
-
Save goncha/067e8135d4422b7da6ec to your computer and use it in GitHub Desktop.
build.gradle including dependency management (provided, exclude, files), svn info, sources jar
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
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 matchLastChangedRev = outputAsString =~ /Last Changed Rev: (\d+)/ | |
project.ext.svnRevision = matchLastChangedRev[0][1] | |
} | |
project.version = project.version + "-${svnRevision}" | |
} catch (Exception e) { | |
} | |
configurations { | |
// provided dependency for yigo artifacts | |
provided { | |
description = 'provided classpath' | |
transitive = true | |
} | |
// exclude jars of lucene modules | |
// elasicsearch client and plugins only need lucene-core | |
compile { | |
exclude module: 'lucene-analyzers-common' | |
exclude module: 'lucene-codecs' | |
exclude module: 'lucene-queries' | |
exclude module: 'lucene-memory' | |
exclude module: 'lucene-highlighter' | |
exclude module: 'lucene-sandbox' | |
exclude module: 'lucene-queryparser' | |
exclude module: 'lucene-misc' | |
exclude module: 'lucene-suggest' | |
exclude module: 'lucene-grouping' | |
exclude module: 'lucene-join' | |
exclude module: 'spatial4j' | |
exclude module: 'lucene-spatial' | |
extendsFrom provided | |
} | |
} | |
repositories { | |
mavenCentral() | |
//maven { | |
// url 'http://NEXUS_HOST/nexus/content/groups/public' | |
//} | |
} | |
dependencies { | |
compile 'org.elasticsearch:elasticsearch:1.1.0' | |
compile 'org.elasticsearch:elasticsearch-query-access-control-filter:1.3' | |
provided fileTree(dir: "${yigoDeploy}\\WEB-INF\\lib", include: '*.jar', exclude: 'lucene-*.jar' ) | |
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('Config') { | |
// from('Config/') { | |
// include '**/*' | |
// } | |
// } | |
into('Config/java/jar/serverJars') { | |
from (configurations.runtime.files - configurations.provided.files) | |
from jar.archivePath | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment