build.gradle
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'eclipse-wtp'
ext {
springVersion = '3.2.0.RELEASE'
strutsVersion = '2.3.16.1'
hibernateVersion = '3.6.10.Final'
}
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
// In this section you declare the dependencies for your production and test code
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5'
providedCompile 'javax.servlet.jsp:jsp-api:2.2'
runtime 'javax.servlet:jstl:1.1.2'
runtime 'mysql:mysql-connector-java:5.1.33'
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.13'
compile 'org.slf4j:slf4j-nop:1.7.13'
compile 'log4j:log4j:1.2.17'
compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
compile 'p6spy:p6spy:2.1.2'
compile 'commons-dbcp:commons-dbcp:1.4'
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'org.hamcrest:hamcrest-library:1.3'
// struts
compile group: 'org.apache.struts', name: 'struts2-core', version: strutsVersion
compile group: 'org.apache.struts', name: 'struts2-spring-plugin', version: strutsVersion
compile group: 'org.apache.struts', name: 'struts2-json-plugin', version: strutsVersion
compile group: 'org.apache.struts', name: 'struts2-junit-plugin', version: strutsVersion
// hibernate
compile group: 'org.hibernate', name: 'hibernate-core', version: hibernateVersion
// spring
compile group: 'org.springframework', name: 'spring-core', version: springVersion
compile group: 'org.springframework', name: 'spring-web', version: springVersion
compile group: 'org.springframework', name: 'spring-orm', version: springVersion
compile group: 'org.springframework', name: 'spring-aop', version: springVersion
compile group: 'org.springframework', name: 'spring-aspects', version: springVersion
compile group: 'org.springframework', name: 'spring-jdbc', version: springVersion
compile group: 'org.springframework', name: 'spring-beans', version: springVersion
compile group: 'org.springframework', name: 'spring-test', version: springVersion
// spring-security
compile group: 'org.springframework.security', name: 'spring-security-web', version: springVersion
compile group: 'org.springframework.security', name: 'spring-security-config', version: springVersion
compile group: 'org.springframework.security', name: 'spring-security-taglibs', version: springVersion
}
jettyRun {
// webAppSourceDirectory = file("src/main/webapp/")
// contextPath = 'myTMS'
httpPort = 8080
stopPort = 9999
}
gradle.properties
// 设置代理
systemProp.http.proxyHost=example.com
systemProp.http.proxyPort=1234
systemProp.https.proxyHost=example.com
systemProp.https.proxyPort=1234
gradle 命令
gradle clean
gradle build
gradle jar
gradle jettyRun
gradle properties
jar 包存储
~/.gradle/caches/modules-2/files-2.1
打可执行jar包
jar {
manifest {
attributes 'Main-Class': 'xxx.xx.MainClass'
}
}
gradle jar
以上方式是不包含依赖包