How to deploy an ant project in dependencies target in gradle


(Ananta Jena) #1

Hi,

I have a project e.g rest-client,it contains many folders like build,jar etc.build folder contain a ant xml file ,after executing the ant xml file a war file is generated in jar folder.

Now i have another project in the same heirachy e.g rest-webapp.and this has a gradle build.now i want to deploy the project rest-client in gradle build of rest-webapp,so that the war file will be included in the ear file present in rest-webapp.along with the entry of the war file.

Another question is let’s say i include a build.xml in gradle.

dependencies { ant.importBuild ‘build.xml’ }

the build.xml is in rest-client.so how i can specify the path here.anyhow i have to provide the exact path of ant build.

is it through. ant.buildDir = buildDir ant.properties.buildDir = buildDir ant.properties[‘buildDir’] = buildDir ant.property(name: ‘buildDir’, location: buildDir)

Please assist me to achieve this.

regards, Ananta


(Peter Niederwieser) #2

ad 1. See Customizing the Ear plugin in the Gradle user guide. Basically you can add an external War with ‘dependencies { deploy files(“path/to/war”) }’.

ad 2. ‘ant.importBuild’ doesn’t belong into the ‘dependencies’ block. You should move it outside. If the build.xml is in another directory, you can do ‘ant.importBuild “path/to/build.xml”’. For setting an Ant property, all of your suggestions will work.