Question about artifacts asthey relate to Community plugins
YAAQ -Yet Another Artifacts Question .
In the artifacts configuration window, you can chose to add Community modules to your plugin's artifact, say, your plugin's jar, if that's what you're creating.
My question is, when do I do this, when I have a dependency on the code in the module ?
My plugin imports TestFramework and my code extends it and I declare such to be the case in the plugin.xml file. However I don't add that module to my artifacts created jar, yet everything works fine.
OTOH when I did mistakenly include modules from Community in my jar, Community threw in a very specific place- FTMananger.createAndStoreBundledTemplate. This was on account of this method having processed a file- in this instance one named: "Html.html" - previously (which is the criteria for an exception to be thrown by this method). I think ../resources-en/inspectionDescriptions contained the "Html.html". By accidentally including this file's module, I had included this file and an excpetion was generated. My bad.
So my question has two like, aspects, or something. One is, what would motivate me to include a Community jar when the combination of the declaration in the plugin.xml file and the normal imports statements seems to be all anyone would ever need?
The second is, in the case where I have imported a module from Community into my artifacts for some good reason, why don't I have to routinely worry that that importation will result in the kind of error I accidentally created above? It seems like Community was being asked, due to the (accidental) inclusion of the Community modules source in my plugin, to process a lot of (its own) files twice, and that error was the result. I can imagine a lot of very funky errors might be created by including Community modules in artifacts and not ones so polite as to blow-up up front. IT might produce runtime errors outside of any try/catch or worse, runtime "freakiness" with no error and no seeming problem.
So I just don't get it.
请先登录再写评论。
The answer to this question is very simple: You never need to include Community Edition modules into the artifacts of your plugin. Doing so will always cause things to break.
Thanks Dmitry!!! But I have to ask, why are they there? W\hy does the artifact dialog present them to me as viable options, as something one might consider doing? The name of the column is "available elements" and the little ? next to the title "available elements" just says "double click on element to put into defualt location , drag and drop to add element to desired ocation.. etc etc. " Doing so results in the addition of the module to your jar. So I am still confused.
What do you mean by "why they are there"? The artifacts feature of IntelliJ IDEA is designed to be used in any project. There is no special logic to detect that the currently opened project is specifically the IntelliJ IDEA Community Edition project, and to disable specifically the Community Edition modules from being added to the artifact.
There is no special logic to detect that the currently opened project is specifically the IntelliJ IDEA Community Edition project, and to disable specifically the Community Edition modules from being added to the artifact.
Well......... why not? :p
Thanks Dmitry !