Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom resolution strategies are not working for integrationTest task #36

Closed
marksarnold opened this issue Jul 26, 2017 · 4 comments
Closed

Comments

@marksarnold
Copy link

marksarnold commented Jul 26, 2017

It seems like version resolution strategies are ignored by the plugin's integrationTest task.
Example:

configurations {
  provided
  all*.resolutionStrategy {
    force 'org.jboss.logging:jboss-logging:3.2.0.Final'
  }
}

Works for compile, test, and ear tasks, but for integrationTest, it does not work (meaning gradle pulls some other version than the one I specified)
This is both with the STS eclipse plugin and also when calling gradle from the command line.
Gradle is version 3.5

@tkrullmann
Copy link
Member

Hi @marksarnold, I haven't been able to reproduce this. Could you paste a bit more of your build script (most importantly, the dependencies and the testSets blocks)?

My suspicion is that your testSets block appears after your configurations block, so the configurations.all property won't know about the integrationTest related configurations at that time.

In that case, either move the testSets block further up, or use the configurations.all { } method instead. which also applies to any future configurations:

configurations {
    all {
        resolutionStrategy {
            force 'org.jboss.logging:jboss-logging:3.2.0.Final'
        }
    }
}

@marksarnold
Copy link
Author

My suspicion is that your testSets block appears after your configurations block,

That is the case. Will try changing that and see if it fixes the problem...

@marksarnold
Copy link
Author

So before, it was like this:

configurations {
...
}

repositories {
...
}

buildscript {
  repositories {
    ...
  }
  dependencies {
    ...
    classpath 'org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:1.0.2' // Java 7 version
  }
}

testSets {
    integrationTest
}

dependencies {
...
}

I pulled testSets up and now it is:

testSets {
    integrationTest
}

configurations {
...
}

repositories {
...
}

buildscript {
  repositories {
    ...
  }
  dependencies {
    ...
    classpath 'org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:1.0.2' // Java 7 version
  }
}

dependencies {
...
}

This fixed the problem.
Is there anything I might break by pulling testSets all the way up? Have ran a quick build and not found anything wrong so far...
Thank you,
Mark

@tkrullmann
Copy link
Member

Great that it works now. No issue I can think of, apart from the pitfall that you just experienced.
I'd strongly recommend using

configurations.all {
    resolutionStrategy { ... }
}

over

configurations.all*.resolutionStrategy { ... }

because the closure version will also be called on any configurations that are added afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants