diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchJavadocPlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchJavadocPlugin.java index dbd8181624f65..56e7cb209dcdf 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchJavadocPlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchJavadocPlugin.java @@ -18,7 +18,6 @@ import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Dependency; import org.gradle.api.artifacts.ProjectDependency; -import org.gradle.api.internal.artifacts.dependencies.ProjectDependencyInternal; import org.gradle.api.plugins.BasePluginExtension; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.tasks.javadoc.Javadoc; @@ -88,7 +87,8 @@ private void configureJavadocForConfiguration(Project project, boolean shadow, C private void configureDependency(Project project, boolean shadowed, ProjectDependency dep) { // we should use variant aware dependency management to resolve artifacts required for javadoc here - Project upstreamProject = project.project(((ProjectDependencyInternal) dep).getIdentityPath().getPath()); + String buildTreePath = dep.getPath(); + Project upstreamProject = project.project(buildTreePath); if (upstreamProject == null) { return; } diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/TestWithDependenciesPlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/TestWithDependenciesPlugin.java index e24b1afa7747b..b561144554f47 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/TestWithDependenciesPlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/TestWithDependenciesPlugin.java @@ -18,7 +18,6 @@ import org.gradle.api.artifacts.dsl.DependencyHandler; import org.gradle.api.attributes.Attribute; import org.gradle.api.attributes.LibraryElements; -import org.gradle.api.internal.artifacts.dependencies.ProjectDependencyInternal; import org.gradle.api.plugins.ExtraPropertiesExtension; import org.gradle.api.tasks.Copy; import org.gradle.api.tasks.SourceSetContainer; @@ -69,9 +68,7 @@ private static void addPluginResources(final Project project, final ProjectDepen project.getObjects().named(LibraryElements.class, LibraryElements.RESOURCES) ); DependencyHandler dependencyHandler = project.getDependencies(); - ProjectDependencyInternal pluginProject = (ProjectDependencyInternal) projectDependency; - - String path = pluginProject.getIdentityPath().getPath(); + String path = projectDependency.getPath(); Dependency pluginMetadataDependency = dependencyHandler.project(Map.of("path", path)); dependencyHandler.add(metadataConfiguration, pluginMetadataDependency); project.getTasks().register(taskName, Copy.class, copy -> { diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java index 32a766953f9b8..8c2a71e010dbb 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java @@ -252,7 +252,7 @@ private void copyDependencies(Project project, DependencySet dependencies, Confi configuration.getDependencies() .stream() .filter(d -> d instanceof ProjectDependency) - .map(d -> project.getDependencies().project(Map.of("path", ((ProjectDependencyInternal) d).getIdentityPath().getPath()))) + .map(d -> project.getDependencies().project(Map.of("path", ((ProjectDependencyInternal) d).getPath()))) .forEach(dependencies::add); } @@ -331,9 +331,7 @@ private Configuration createPluginConfiguration(Project project, String name, bo Dependency dependency = iterator.next(); // this logic of relying on other projects metadata should probably live in a build service if (dependency instanceof ProjectDependency projectDependency) { - Project dependencyProject = project.project( - ((ProjectDependencyInternal) projectDependency).getIdentityPath().getPath() - ); + Project dependencyProject = project.project(((ProjectDependencyInternal) projectDependency).getPath()); List extendedPlugins = dependencyProject.getExtensions() .getByType(PluginPropertiesExtension.class) .getExtendedPlugins();