One jar Package included all dependencies
apply plugin: 'java'
version '1.0'
jar {
//All dependencies into one jar.
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes 'Implementation-Title':'Title', 'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
dependencies {
compile project(':common:logger')
compile group:"redis.clients", name:"jedis", version:"2.4.2"
compile group:"org.apache.httpcomponents", name:"httpclient", version:"4.3.3"
compile group:"org.apache.httpcomponents", name:"httpmime", version:"4.3.3"
compile group:"org.eclipse.jetty", name:"jetty-servlet", version:"9.2.0.RC0"
compile group:"com.sun.jersey", name:"jersey-bundle", version:"1.18.1"
compile group:"com.google.code.gson", name:"gson", version:"2.2.4"
compile group:"com.github.jedis-lock", name:"jedis-lock", version:"1.0.0"
compile group:"org.mongodb", name:"mongo-java-driver", version:"2.12.1"
compile group:"com.ning", name:"async-http-client", version:"1.8.9"
testCompile group:"junit", name:"junit", version:"4.11+"
}
One jar Package referenced all dependencies (Copy into lib folder)
apply plugin: 'java'
version '1.0'
//Copy all dependencies
task copyToLib( type: Copy ) {
into "$buildDir/libs/lib"
from configurations.runtime
}
jar {
//Copy all dependencies dependsOn copyToLib
manifest {
attributes 'Implementation-Title':'Title', 'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
dependencies {
compile project(':common:logger')
compile group:"redis.clients", name:"jedis", version:"2.4.2"
compile group:"org.apache.httpcomponents", name:"httpclient", version:"4.3.3"
compile group:"org.apache.httpcomponents", name:"httpmime", version:"4.3.3"
compile group:"org.eclipse.jetty", name:"jetty-servlet", version:"9.2.0.RC0"
compile group:"com.sun.jersey", name:"jersey-bundle", version:"1.18.1"
compile group:"com.google.code.gson", name:"gson", version:"2.2.4"
compile group:"com.github.jedis-lock", name:"jedis-lock", version:"1.0.0"
compile group:"org.mongodb", name:"mongo-java-driver", version:"2.12.1"
compile group:"com.ning", name:"async-http-client", version:"1.8.9"
testCompile group:"junit", name:"junit", version:"4.11+"
}
댓글을 달아 주세요
댓글 RSS 주소 : http://www.yongbi.net/rss/comment/602