question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gradle plugin depends on testClasses

See original GitHub issue

Currently the Gradle-plugin adds in Java-projects a dependency on testClasses:

flyway-gradle-plugin/src/main/groovy/org/flywaydb/gradle/task/AbstractFlywayTask.groovy:
AbstractFlywayTask() {
    group = 'Flyway'
    project.afterEvaluate {
        if (isJavaProject()) {
            this.dependsOn(project.tasks.testClasses)
        }
    }
    extension = project.flyway
}

In my application, I migrate the schema with Flyway and then, based on the up-to-date schema, generate Java-code which is then compiled. This however results in a circular dependency:

> gradle compileJava
FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:classes
\--- :compileJava
     \--- :generateJooq
          \--- :flywayMigrate
               \--- :testClasses
                    \--- :compileTestJava
                         \--- :classes (*)

BUILD FAILED

I have tried everything of which I can think to fix this, from manually removing the dependency to putting the Flyway-migrations into a subproject. I have come to the conclusion that the only feasible solution is to alter the plugin itself to remove the added dependency. Could you please therefore do so? Thank you.

Best regards

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
konrad-garuscommented, Nov 21, 2014

Actually, it appears to be more subtle. Perhaps flywayClean should have no dependencies at all, and flywayMigrate should depend on [processResources, processTestResources]?

In my project I ended up with the following, because I do happen to have the migration scripts in src/main/resources/db/migration:

project.afterEvaluate {
    flywayClean.dependsOn -= testClasses
    flywayMigrate.dependsOn = [processResources, processTestResources]
}
0reactions
axelfontainecommented, Dec 30, 2015

Fixed as part of #979

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Java Plugin - Gradle User Manual
Depends on: build , and buildNeeded tasks in all projects that are dependencies in the testRuntimeClasspath configuration. Performs a full build of the...
Read more >
Multi-project test dependencies with gradle - Stack Overflow
Problem is that dependency testCompile project(':core').sourceSets.test.output actually means: "depend on classes generated by gradle build task".
Read more >
Separate Gradle Tasks for Unit and Integration Tests - Inspeerity
Since now you can move all your integration tests to proper folder, and all of them will have all dependencies which are defined...
Read more >
5. Add Gradle Plugin with Dependencies - Spring Cloud
To add a Gradle plugin with dependencies, you can use code similar to the following ... Specifies a rule that should be added...
Read more >
Gradle: sub-project test dependencies in multi-project builds
I'am currently working on a project where we try to move an ant based build to gradle. One task is to make the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found