Created
December 24, 2011 07:05
-
-
Save bluepapa32/1516658 to your computer and use it in GitHub Desktop.
Apache Lucene DEMO with Gradle
This file contains hidden or 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
configurations { | |
demo | |
source | |
} | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
demo 'org.apache.lucene:lucene-core:3.5.0' | |
demo 'org.apache.lucene:lucene-demo:3.5.0' | |
source 'org.apache.lucene:lucene-core:3.5.0:sources' | |
} | |
task init { | |
onlyIf { !file('src').exists() } | |
doLast { | |
ant.mkdir(dir: 'src') | |
ant.unzip(src: configurations.source.singleFile, dest: 'src'); | |
} | |
} | |
task index(type: JavaExec, dependsOn init) { | |
main = 'org.apache.lucene.demo.IndexFiles' | |
classpath configurations.demo | |
args '-docs', 'src' | |
} | |
tasks.addRule("Pattern: ?<query>") { String taskName -> | |
if (taskName.startsWith("?")) { | |
task(taskName, type: JavaExec) { | |
main = 'org.apache.lucene.demo.SearchFiles' | |
classpath configurations.demo | |
args '-query', taskName[1..-1] | |
args '-paging', project.hasProperty('paging') ? paging : 1000 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment