java ee项目用gradle依赖打包

plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'application'
}

//mainClassName = ConnectionElasticSearch
group 'com.xxx'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Main-Class': 'com.xxx.ConnectionElasticSearch'
}
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}

repositories {
// mavenCentral()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
}

dependencies {
compile group: 'com.sun.mail', name: 'javax.mail', version: '1.6.2'
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.62'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.1'
compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '6.6.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
}

posted @ 2019-11-01 14:41  渔阳nice  阅读(254)  评论(0编辑  收藏  举报