I have a project that uses gradle, flyway gradle plugin, mybatis generator and postgres. In my build.gradle, I have:
compileJava.dependsOn('myBatisGenerator')
I would like to run the flywayMigrate task before myBatisGenerator runs. So I did the following:
myBatisGenerator.dependsOn('flywayMigrate')
And when I try to run the build using gradle test, I get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Circular dependency between the following tasks:
:classes
+--- :compileGroovy
| \--- :compileJava
| \--- :myBatisGenerator
| \--- :flywayMigrate
| \--- :testClasses
| +--- :compileTestGroovy
| | +--- :classes (*)
| | \--- :compileTestJava
| | \--- :classes (*)
| \--- :compileTestJava (*)
\--- :compileJava (*)
(*) - details omitted (listed previously)
I am not sure why compileTestJava is being called from within the flywayMigrate plugin. Any ideas how to work around the issue and still have the flyway plugin run before mybatis generator?