No CustomWebBuildParticipant in IDEA 9
Hi,
for my IDEA 8 plugin, I use com.intellij.javaee.web.make.CustomWebBuildParticipant, which is part of plugins/JavaEE/lib/javaee-openapi.jar. Despite of the JAR's name ("openapi"), this class disappeared in IDEA 9.
My use case is that for depdencies to certain libraries, certain additional files have to be copied into the Web app, similar to copying JARs to WEB-INF/lib. I simply had to extend CustomWebBuildParticipant, declare my subclass in plugin.xml, and implement registerBuildInstructions(), like so:
plugin.xml:
<extensions defaultExtensionNs="com.intellij">
<javaee.web.customBuildParticipant implementation="net.jangaroo.ide.idea.JangarooWebBuildParticipant"/>
</extensions>
JangarooWebBuildParticipant.java:
...
public class JangarooWebBuildParticipant extends com.intellij.javaee.web.make.CustomWebBuildParticipant {
public void registerBuildInstructions(WebFacet webFacet, BuildRecipe buildRecipe, CompileContext compileContext) {
...
}
}
As an attachment, find the complete Java code of that class.
How can I achieve the same effect in IDEA 9? Any help would be appreciated!
Greetings,
Frank
Attachment(s):
JangarooWebBuildParticipant.java.zip
请先登录再写评论。
blind guess:
com.intellij.javaee.web.artifact.WebArtifactUtil
Hello,
exploded/war configurations have been moved from facets to artifacts so it wasn't possible to keep old API. In order to achive the same effect in IDEA
9 you can add DirectoryCopyPackagingElement to an artifact output layout when your facet is created. Use the following methods to add directory copy
to an artifact layout:
ArtifactManager.getInstance(project).addElementsToDirectory(artifact, relativeOutputPath,
PackagingElementFactory.getInstance().createDirectoryCopyWithParentDirectories(pathToDirectory, ""));
To obtain all artifacts which contains some web facet use method
JavaeeArtifactUtil.getInstance().getArtifactsContainingFacet(webFacet, null)
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Thanks, that helps a lot!
I already stumbled upon "artefacts" and was successful in extending com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.FacetBasedPackagingSourceItemsProvider. The only thing that is missing now is that my MavenImporter adds my custom compile output automatically to the corresponding Web artefacts. I guess your pointers should make it easy implementing this logic!