Navigate to Gradle dependencies programmatically

已回答

Hello,

 

In our plugin, I need to open the Gradle dependencies programmatically. For example, we use the next source code to open Maven dependencies

val file = mavenProject.getFile

val artifact = mavenProject.findDependencies(group, name).asScala.head

val navigation = MavenNavigationUtil.createNavigatableForDependency(project, file, artifact)
navigation.navigate(true)

 

Gradle is an external system and I'm trying to understand how to make similar functionality for the Gradle dependencies.

 

Very grateful for any help!

 

Best regards,

Alexander.

 

1

Hello Alexandr,

Unfortunately, there is no way to generate such Navigatable automatically with the Gradle plugin.

I'm afraid that you'll have to find proper PsiElement in the Gradle build file by your own - i.e., with

PsiUtil.getElementAtOffset

 

0

请先登录再写评论。