Gradle Project development

Gradle usable commands 

1)gradle
2)gradle tasks
3)gradle build
4)gradle wrapper
4)gradle cleanEclipse eclipse
5)gradle clean test
6)gradle clean compilejava

build.gradle

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
group='org.own.ste'

def springSecurityGroup='org.springframework.security'
def springSecurityVersion='3.2.3.RELEASE'
def springSecurityDeps=['spring-security-web','spring-security-config','spring-security-taglibs','spring-security-ldap']


repositories {
mavenLocal()
    mavenCentral()
}

compileJava {
source = fileTree(dir: 'src/main',include:'**/*.java')
}

war {
    baseName = 'testapp'
    version =  '0.1.0'
}

dependencies {
// Dependent Libraries
def spring_deps=['spring-aop','spring-core','spring-beans','spring-context','spring-context-support','spring-jdbc','spring-tx','spring-orm','spring-web','spring-webmvc']
def hibernate_deps=['hibernate-core','hibernate-entitymanager']
def jackson_deps=['jackson-core','jackson-databind']
def spring_test_deps=['spring-test']
def springVersion = "4.0.2.RELEASE"
def hibernateVersion = "4.3.1.Final"
def jacksonVersion = "2.3.0"
def springGroup='org.springframework'
def hibernateGroup='org.hibernate'
def jacksonGroup='com.fasterxml.jackson.core'

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == springGroup) {
details.useVersion springVersion
}
}
}
// Other deps
compile 'log4j:log4j:1.2.17'
compile 'org.slf4j:slf4j-api:1.7.6'
compile 'org.slf4j:slf4j-log4j12:1.7.6'
compile 'org.apache.cxf:cxf-api:2.7.10'
compile 'org.apache.cxf:cxf-rt-core:2.7.10'
compile 'javax.mail:mail:1.4.7'
compile 'aspectj:aspectjrt:1.5.4'
compile 'org.aspectj:aspectjweaver:1.7.4'
compile 'javax.servlet:javax.servlet-api:3.0.1'
compile 'org.springframework.batch:spring-batch-core:2.2.3.RELEASE'
compile 'javax.validation:validation-api:1.0.0.GA'
       //this  is for tomcat runtime files.
        providedCompile 'org.apache.tomcat:tomcat-servlet-api:7.0.30'
        providedCompile 'org.apache.tomcat:tomcat-jsp-api:7.0.30'
// Spring & Hibernate
spring_deps.each {compile group:springGroup,name:it,version:springVersion}
hibernate_deps.each {compile group:hibernateGroup,name:it,version:hibernateVersion}
jackson_deps.each {compile group:jacksonGroup,name:it,version:jacksonVersion}
// Test Compile
testCompile 'com.mchange:c3p0:0.9.2.1'
testCompile 'org.springframework:spring-test:2.5'
testCompile 'junit:junit:4.6'
spring_test_deps.each {testCompile group:springGroup,name:it,version:springVersion}
springSecurityDeps.each{compile group:springSecurityGroup,name:it,version:springSecurityVersion};
// Runtime Deps
runtime 'commons-fileupload:commons-fileupload:1.3.1'
runtime 'com.h2database:h2:1.3.175'
runtime 'org.apache.tomcat:tomcat-catalina:7.0.16'
// HACK - TO BE FIXED.
runtime 'mysql:mysql-connector-java:5.1.29'
//this is specail purpose check.
def jstlDeps=['javax.servlet.jsp.jstl:jstl-api:1.2','jstl:jstl:1.2']
jstlDeps.each{
runtime (it) {
exclude(group: 'javax.servlet', module:'servlet-api')
exclude(group: 'javax.servlet.jsp', module:'jsp-api')
}
}
 
}
task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

Comments