Gradle config for plugin

plugin code is organized in 2 projects:

project Base refers to some code in intellij framework and some external libraries; is built to a local .jar

project Plugin refers to project Base jar, intellij framework and some external libraries.

 

how would you write build.gradle config files for projects Base and Plugin?

specifically, any hints re: group, module, version?

 

After building Base with gradle, when trying to build Plugin, this error comes up:

Could not resolve com.intellij.base:1.0:.

inconsistent module metadata found. Descriptor: com.jetbrains:idea:LATEST-EAP-SNAPSHOT

Errors: bad group: expected='com.intellij.base' found='com.jetbrains'

bad module name: expected='1.0' found='idea'

bad version: expected='' found='LATEST-EAP-SNAPSHOT'

 

10 comments
Comment actions Permalink
Official comment

I believe that you just do not have `libs/base-1.0.jar` under your project's base dir, so the `base` dependency is unresolved. It has nothing to do with intellij or gradle-intellij-plugin.

 

Unrelated notices:

- You use very old version of `gradle-intellij-plugin`

- There is no any sense to depend on `gradle-intellij-plugin`

Comment actions Permalink

> the error appeared before a dep to local jar existed in build.gradle

I see. I think it makes sense to look at Multi-module projects and add dependency to base subproject (`compile project(':base_plugin')`). Here is an example (https://github.com/go-lang-plugin-org/go-lang-idea-plugin/blob/master/build.gradle#L88), not the best one though.

The second option is to use Composite Build: give Gradle path to `base` project so it will be able to build it before running build of the Plugin project. I'm not sure how to configure it properly but I believe it's possible.

Also, please take a look at example projects https://github.com/JetBrains/gradle-intellij-plugin/#examples. Some of them quite complicated and likely solved all possible issues that you can face during plugin development.

Hope this helps.

1
Comment actions Permalink

Plugin project build.gradle can refer to Base jar like this:

dependencies {
compile files('libs/base-1.0.jar')
}

 

0
Comment actions Permalink

Please provide whole `build.gradle`. How do you depend on IntelliJ dependencies?

0
Comment actions Permalink

complete build.gradle files for both Base and Plugin are here 

they seem to work. 

0
Comment actions Permalink

 

>  There is no any sense to depend on `gradle-intellij-plugin`

thank you. I will remove this dep.

 

the error in the original post in this topic appeared with different build.gradle files.

the jar file exist in the libs dir. These gradle config files work. 

0
Comment actions Permalink

> the error in the original post in this topic appeared with different build.gradle files.

The error describes the only the latest lsource that was used for resolving base.jar, if the jar was there, the dependency would be resolved earlier.

Just disable gradle-intellij-plugin and I think you'll get the same unresolved dependency but with a different error message

0
Comment actions Permalink

> the jar file exist in the libs dir. These gradle config files work. 

By the way, you depend on `libs/libs/plugin_base-1.0.jar`, not on `libs/plugin_base-1.0.jar`. I'm not sure what do you mean by 'gradle config files work' and how you checked it but please check it one more time.
0
Comment actions Permalink

> The error describes the only the latest lsource that was used for resolving base.jar, if the jar was there, the dependency would be resolved earlier.

the error appeared before a dep to local jar existed in build.gradle

проехали ;) Спасибо за помощь!

 

> I'm not sure what do you mean by 'gradle config files work'

the plugin builds with these config files. plugin.zip is loaded by Intellij and works.

0
Comment actions Permalink

Thank you Alexander. I appreciate this.

Hopefully someone else will find this topic useful.

0

Please sign in to leave a comment.