diff --git a/buildSrc/src/test/java/org/elasticsearch/gradle/BuildExamplePluginsIT.java b/buildSrc/src/test/java/org/elasticsearch/gradle/BuildExamplePluginsIT.java index 2a2304182c80e..c21adf22bcbe9 100644 --- a/buildSrc/src/test/java/org/elasticsearch/gradle/BuildExamplePluginsIT.java +++ b/buildSrc/src/test/java/org/elasticsearch/gradle/BuildExamplePluginsIT.java @@ -40,13 +40,15 @@ public class BuildExamplePluginsIT extends GradleIntegrationTestCase { - private static List EXAMPLE_PLUGINS = Collections.unmodifiableList( + private static final List EXAMPLE_PLUGINS = Collections.unmodifiableList( Arrays.stream( Objects.requireNonNull(System.getProperty("test.build-tools.plugin.examples")) .split(File.pathSeparator) ).map(File::new).collect(Collectors.toList()) ); + private static final String BUILD_TOOLS_VERSION = Objects.requireNonNull(System.getProperty("test.version_under_test")); + @Rule public TemporaryFolder tmpDir = new TemporaryFolder(); @@ -96,7 +98,8 @@ public void testCurrentExamplePlugin() throws IOException { private void adaptBuildScriptForTest() throws IOException { // Add the local repo as a build script URL so we can pull in build-tools and apply the plugin under test - // + is ok because we have no other repo and just want to pick up latest + // we need to specify the exact version of build-tools because gradle automatically adds its plugin portal + // which appears to mirror jcenter, opening us up to pulling a "later" version of build-tools writeBuildScript( "buildscript {\n" + " repositories {\n" + @@ -105,7 +108,7 @@ private void adaptBuildScriptForTest() throws IOException { " }\n" + " }\n" + " dependencies {\n" + - " classpath \"org.elasticsearch.gradle:build-tools:+\"\n" + + " classpath \"org.elasticsearch.gradle:build-tools:" + BUILD_TOOLS_VERSION + "\"\n" + " }\n" + "}\n" );