gradle dependencies

Answered

I created plugin with the following dependencies:

compile group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.6'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
compile group: 'joda-time', name: 'joda-time', version: '2.10'
compile group: 'com.google.guava', name: 'guava', version: '26.0-jre'

and it is working perfect. 

Then I added more dependencies:

compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
compile group: 'org.hibernate.validator', name: 'hibernate-validator', version: '6.0.13.Final'
compile group: 'javax.el', name: 'javax.el-api', version: '3.0.0'
compile group: 'org.glassfish', name: 'javax.el', version: '3.0.0'

and it is working perfect when I tested plugin with runIde task on local. 

When I added jar file to IDEA I got exception: java.lang.NoClassDefFoundError: javax/validation/Validation

In both cases jar file does't contain any dependencies. 

What did I miss?

 

6 comments
Official comment

> When I added jar file to IDEA I got exception: java.lang.NoClassDefFoundError: javax/validation/Validation

gradle-intellij-plugin never creates jar. It generates zip with all dependencies in `build/distributions`.

Update build.gradle

jar {
    from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
0

@Alexander Zolotov

Do I need to select zip instead of jar when Im uploading file via "install plugin from disk" in IDEA or when Im uploading file to jetbrains plugin repo?

Plugins folder in IDEA contains jar files only.

 

0

 > Do I need to select zip instead of jar when Im uploading file via "install plugin from disk" in IDEA or when Im uploading file to jetbrains plugin repo?

yes

> Plugins folder in IDEA contains jar files only.

These plugins are unpacked zips

0

@Alexander Zolotov

It works.

Thanks 

0

Please sign in to leave a comment.