Create a ear having war inside it in the same project


(Rahul Verma) #1

Hello, i have one build.gradle which is generating war inside Build-libs for the project. Structure of project is like pResource

|

-------Java Resource

|

----src/main -> (all java inside it in diff package)

----src/test

build.gradle

build.gradle looks like,

apply plugin: ‘java’ apply plugin: ‘eclipse’ apply plugin: ‘war’

sourceCompatibility = 1.7 version = ‘1.0’ tomcat_home=‘C:/apache-tomcat-6.0.37-windows-x64/apache-tomcat-6.0.37’ ext.projectJar = “C:/Users/r.kumar.verma/Desktop/referenceAppJar”

jar {

manifest {

attributes ‘Implementation-Title’: ‘Gradle Quickstart’, ‘Implementation-Version’: version

} }

sourceSets {

main {

java {

srcDir ‘src/main’

}

}

test {

java {

srcDir ‘src/test’

}

} }

repositories {

mavenCentral() }

dependencies {

compile group: ‘commons-collections’, name: ‘commons-collections’, version: ‘3.2’

testCompile group: ‘junit’, name: ‘junit’, version: ‘4.+’

providedCompile ‘javax.servlet:servlet-api:2.5’

runtime ‘javax.servlet:jstl:1.1.2’

compile fileTree(dir: ‘WebContent/WEB-INF/lib’, include: ‘*.jar’)

// compile fileTree(dir: projectJar, include: ‘*.jar’) }

test {

systemProperties ‘property’: ‘value’ }

uploadArchives {

repositories {

flatDir {

dirs ‘repos’

}

}

}

task deployToTomcat(type: Copy) {

from war

into “${tomcat_home}/webapps”

println “Copy from ${war} into ${tomcat_home}/webapps”

}

I tried adding plugin ear but the issue is coming.