JavaEE dependency in a plugin

Hi,

My Plugin depends on javaee.jar. In IDEA 8.x it was included in the IDEA own classpath inherited by plugin so was accessible to plugin automatically. In IDEA 9 it is no longer the case. I can certainly add it as a library to plugin but then javaee.jar is exported and bundled with the plugin which seems rather execssive.

My plugin depends on com.intellij.javaee plugin and I assume the latter also uses classes from javaee.jar so it is probably available to IDEA classloader. In fact I can see a file named resources/versions/libraries_javaee.xml that has lines like:

<lib version="5" jar-name="javaee.jar" required-classes="javax.interceptor.AroundInvoke"/>

but I can not see any documentation that explains how it works.

Is there any clean way to include javaee.jar as a dependent library for a plugin without exporting and bundling it?

Any ideas are greatly appreciated.

Misha Bouzinier

4 comments
Comment actions Permalink

Hello Misha,

There's no production code in com.intellij.javaee plugin that directly references something from javaee.jar.
In version 9 we faced the need of bundling 3 different version of the jar so we decided not to do this but made it downloadable
from our site. That what that libraries.xml you posted is about.
If you really depend on those classes and not just use their names you may want to assist user to provide you with a jar.
All the dependent functionality can be developed with the jar but in production it will run only in presence of the classes.

Otherwise bundling (may be as a separate plugin so that other plugins will be able to use it) seems to be the only option.


Gregory Shrago



On 14.06.2010 21:52, Misha Bouzinier wrote:

Hi,

>

My Plugin depends on javaee.jar. In IDEA 8.x it was included in the IDEA own classpath inherited by plugin so was accessible
to plugin automatically. In IDEA 9 it is no longer the case. I can certainly add it as a library to plugin but then
javaee.jar is exported and bundled with the plugin which seems rather execssive.

>

My plugin depends on com.intellij.javaee plugin and I assume the latter also uses classes from javaee.jar so it is probably
available to IDEA classloader. In fact I can see a file named resources/versions/libraries_javaee.xml that has lines like:

>

<lib version="5" jar-name="javaee.jar" required-classes="javax.interceptor.AroundInvoke"/>

>

but I can not see any documentation that explains how it works.

>

Is there any clean way to include javaee.jar as a dependent library for a plugin without exporting and bundling it?

>

Any ideas are greatly appreciated.

>

Misha Bouzinier

>

--- Original message URL: http://www.jetbrains.net/devnet/message/5265424#5265424


0
Comment actions Permalink

Thank you, Gregory,

very helpful answer, I very well understand the problem with 3 releases of the library. I guess I still need an advice on the best way to proceed. In this particular plugin I do not care what version of javaee (or j2ee) is used, I need components that are there from the beginning and has not changed much. I already provide user with a prompt to download javaee.jar as their project library however for the plugin to work I need this jar to be loaded by the same classloader as plugin itself. Downloading a library to IDEA libs seems wrong for the exact reason you pointed out: it might conflict with other plugins that might require a different version. Bundling it with my own plugin still seem to be wasteful though it makes sense now. Creating another plugin that just contains the library seems the best and very easy solution but I do not feel it is my job to do: this would be a very general plugin and in my opinion you JetBrains people are in the best position to do it.

What is your advice?

Thanks again,

Misha Bouzinier

0
Comment actions Permalink

Loading some extra/3rd party classes means less PermGen space.
I prefer putting that kind of functionality into a separate process.
With this approach you control the classpath.

BTW What Java EE classes we talk about?

There's not much demand for the "unbundled" Java EE jar plugin.
(It would be unbundled because that was the whole point of the removal in the first place)

Gregory Shrago

On 15.06.2010 21:01, Misha Bouzinier wrote:

Thank you, Gregory,

>

very helpful answer, I very well understand the problem with 3 releases of the library. I guess I still need an advice on the
best way to proceed. In this particular plugin I do not care what version of javaee (or j2ee) is used, I need components that
are there from the beginning and has not changed much. I already provide user with a prompt to download javaee.jar as their
project library however for the plugin to work I need this jar to be loaded by the same classloader as plugin itself.
Downloading a library to IDEA libs seems wrong for the exact reason you pointed out: it might conflict with other plugins
that might require a different version. Bundling it with my own plugin still seem to be wasteful though it makes sense now.
Creating another plugin that just contains the library seems the best and very easy solution but I do not feel it is my job
to do: this would be a very general plugin and in my opinion you JetBrains people are in the best position to do it.

>

What is your advice?

>

Thanks again,

>

Misha Bouzinier

>

--- Original message URL: http://www.jetbrains.net/devnet/message/5265524#5265524


0
Comment actions Permalink

I understand. I am talking about javax.persistence annotations  classes. In the plugin proper I use PSI to read and analyze annotations so I do not need them in the classpath just in user libraries. However at some stage I call a tool that uses reflection to analyze those annotations and here I need them loaded. I realize that one can argue that bdunling the whole javaee.jar just to be able to read a few annotation classes is waste but I am not ssure what is a better solution. By the way, the tool is called as a compiler task so maybe I can just modify the classpath compiler task uses?

Thanks,

Misha

0

Please sign in to leave a comment.