Gradle plugin sources linkage
Hi,
i'm developping a gradle plugin and i can't figure out how to link sources when using it in build.gradle.
For example if you're are using com.android.tools.build:gradle:1.3.1, in your build.gradle you may go to sources if you ctrl+click android extension closure. I can't achieve it though my plugin contains sources as well (checked from USER/.gradle/caches/ sources.jar exists)
Thanks for help
Please sign in to leave a comment.
Open Module Settings (in Mac - Command + ;) navigate to Libraries select the library and click "+" on the right bottom down to add/link the sources
i can't see any library added from gradle plugins.
When applying com.android.tools.build:gradle:1.3.1 for example you don't need to add any sources to get access to it.
Can't figure out what's wrong here, source files from android tools are located in [user].gradle\caches\modules-2\files-2.1\, mine are there as well but i can't navigate through class
IntelliJ should resolve sources automalically for dependencies defined at buildscript -> dependencies -> classpath
Try the following:
add something similar to your gradle script:
//------
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'you.plugin.dep'
}
}
apply plugin: 'your.plugin.id'
//--------
then refresh the project using 'Refresh' button from Gradle tool window and add some fqn of a class from your plugin jar to this gradle script and try to navigate.
Does it work?
Hello,
That actually the problem i can't navigate through properties of my plugin though script execute well, i checked workspace.xml (in .idea) and my plugin jar and source pathes are ok (i checked sources.jar as well and it's not empty ;)
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.samystudio.flair/flair-gradle-plugin/0.5.3/6672af8b0449a562f65ddd815e1c3a8c44f89255/flair-gradle-plugin-0.5.3-sources.jar" />
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.samystudio.flair/flair-gradle-plugin/0.5.3/3f9d801187d647a477c3f933dfec4f7afc4cef27/flair-gradle-plugin-0.5.3.jar" />
Could the plugin itself cause this problem?
Thx
Do I understand you correctly that you want to have resolved your custom gradle plugin DSL code, not just classes from the jar?
If yes,it's not supported out-of-the-box, you need to write and install an IntelliJ plugin which can do it, like it was done in IntelliJ gradle aware plugins like IntelliJ Gradle, android plugins etc, you can find details at https://github.com/JetBrains/intellij-community/blob/master/plugins/gradle/src/org/jetbrains/plugins/gradle/service/resolve/GradleMethodContextContributor.java
You can also watch/vote for the issue at https://youtrack.jetbrains.com/issue/IDEA-143459
Ok yes that's what i need, i'll vote for it!
But then why when using android tools plugin i can navigate trough DSL code in build.gradle?
Thx
as I wrote in previous comment, because it's implemented for this particular android DSL in Android IntelliJ plugin using GradleMethodContextContributor extension point,
Ok i miss read that part ;)
Thx for your answer!
Just to clarify Android IntelliJ plugin != android gradle plugin.
Android IntelliJ plugin is an IDE plugin
android gradle plugin is a gradle plugin
please excuse my tautology :)