Hi, I am fairly new to Gradle and are trying to migrate from Ant. The Ant script is messy, so a complete move has to be done over time.
I tried at least half a dozen strategies, but ended up just running the entire ant build from Gradle, as a start with
build.dependsOn ‘ant-warbuild’"
The “easiest” solution, I think, would be to replace an ant task at a time with its corresponding gradle task. But lifecycles dont exactly match and there are some weird steps in the ant script. Since the Gradle lifecycle would control everything. I dont know exactly how to do that.
The Ant script consists of the following tasks:
- clean.and.init
- gen.hibernate.mappings
- copy.server.code (this is the really weird one)
- “java compile”
- “copy other files” (also weird)
- warbuild
I have manage to get ant to run the hibernate mappings from Gradle and Gradle to compile the java code. For the rest of the tasks listed above, it would be nice to run it as the Ant tasks, after the compile and as part of the Gradle lifecycle.
Here is the script so far:
plugins {
id 'java-library'
}
project.version = '6.0.3-SNAPSHOT'
project.archivesBaseName = 'patient'
compileJava.dependsOn 'ant-gen.mappings'
dependencies {
implementation project(':patient-interface')
implementation fileTree(dir: 'lib', include: '*.jar')
implementation fileTree(dir: 'lib-build', include: '*.jar')
}
How can I inject the “copy.file…” tasks and “warbuild” task after “compileJava” as the final tasks of the build, replacing the default tasks for this part?
Any suggestions on how to proceed, is much appreciated.