How can i get a web modules deployment descriptors path ?

I have to have access to a web modules deployment descriptors. I've been digging the Module class but couldn't find that information. Anyone knows how to do this ?

Thanks

Hugo

13 comments
Comment actions Permalink

Nevermind, figured this one out.

0
Comment actions Permalink

Would you mind sharing your knowledge with us?

Hugo Palma wrote:

Nevermind, figured this one out.


--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

Of course not, that what knowledge is for :o)

J2EEModuleProperties moduleproperties = J2EEModuleProperties.getInstance(myModule);
J2EEDeploymentDescriptor[] dds = moduleproperties.getDeploymentDescriptors();

0
Comment actions Permalink

J2EEDeploymentDescriptor, seems to be missing in 9.x version, Is there a counterpart for it now?

0
Comment actions Permalink

webFacet.getDescriptorsContainer().getConfigFile(DeploymentDescriptorsConstants.WEB_XML_META_DATA).getUrl()

J2EEDeploymentDescriptor, seems to be missing in 9.x version, Is there a counterpart for it now?

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



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Thanks Nikolay Chashnikovfor the instant reply. One final thing, I am using the IntelliJ CE, and the snippet mentioned by you make use of javaee package, officially part of UE.  Does that mean, making it part of CE is compilation of javaee package and bundling it in plugin jar.

0
Comment actions Permalink

If your plugin depends on JavaEE classes you won't be able to use it in IDEA CE.

Thanks Nikolay Chashnikovfor the instant reply. One final thing, I am using the IntelliJ CE, and the snippet mentioned by you make use of javaee package, officially part of UE.  Does that mean, making it part of CE is compilation of javaee package and bundling it in plugin jar.


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



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Previously with intelliJ 5.0 we used to create web modules using J2EEModuleProperties and J2EEDeploymentDescriptor. I am stuck with snippet present in old module

     J2EEModuleProperties webProps = J2EEModuleProperties.getInstance(webModule);
     J2EEDeploymentDescriptor[] descriptors = webProps.getDeploymentDescriptors();
     if (descriptors.length > 0) {
            descriptors[0].setUrl(webModuleRoot.getAbsolutePath() + "\\WEB-INF\\web.xml");
     }   
as these classes has been removed altogether. Now as said by you
        webFacet.getDescriptorsContainer().getConfigFile(DeploymentDescriptorsConstants.WEB_XML_META_DATA).getUrl()
can be used.

I am assuming that I have to
1. Create a simple java module (cannot create a web module as initially it was done by ModulyType.web)
2.  Attach a web facet to it with
     FacetType type = FacetTypeRegistry.getInstance().findFacetType(WebFacet.ID);
     FacetManager.getInstance(webModule).addFacet(type, moduleName, null);
How would I add the descriptors as defined above.

Also,
We have the license for Intellij 5 and had build up a custom plugin for that. Now we have decided to purchase IntelliJ 9 license, and the resposibility of migrating the plugin lies upon me.
Since I am new to Intellij plugin development field, I am facing hell lot of difficulty as there is neither java docs or proper documentation nor any kind of tutorial. I tried looking into API of 5.0 and it contains no description at all. I have read the architecture and various other documentation available at (http://confluence.jetbrains.net/display/IDEADEV/PluginDevelopment) .
Is there any other way I can expedite the process other than looking for individual queries posted in confluence and make desperate try of bringing any sense how so ever little I can.

Appreciate the prompt replies I have got till now

0
Comment actions Permalink

WebModuleType was removed in IDEA 7. You indeed need to use Java module with WebFacet instead.
To add a descriptor you can use
webFacet.getDescriptorsContainer().getConfiguration().addConfigFile(DeploymentDescriptorsConstants.WEB_XML_META_DATA, webXmlUrl).

Unfortunately there are no other sources of documentation/tutorials regarding plugin development.

Previously with intelliJ 5.0 we used to create web modules using J2EEModuleProperties and J2EEDeploymentDescriptor. I am stuck with snippet present in old module

+     J2EEModuleProperties webProps = J2EEModuleProperties.getInstance(webModule);+
+     J2EEDeploymentDescriptor[] descriptors = webProps.getDeploymentDescriptors();+
+     if (descriptors.length > 0) {+
+            descriptors[0].setUrl(webModuleRoot.getAbsolutePath() + "
WEB-INF
web.xml");+
+     }  +
as these classes has been removed altogether. Now as said by you
+        webFacet.getDescriptorsContainer().getConfigFile(DeploymentDescriptorsConstants.WEB_XML_META_DATA).getUrl()+
can be used.

I am assuming that I have to
1. Create a simple java module (cannot create a web module as initially it was done by ModulyType.web)
2.  Attach a web facet to it with
+     FacetType type = FacetTypeRegistry.getInstance().findFacetType(WebFacet.ID);+
FacetManager.getInstance(webModule).addFacet(type, moduleName, null);
How would I add the descriptors as defined above.

Also,
We have the license for Intellij 5 and had build up a custom plugin for that. Now we have decided to purchase IntelliJ 9 license, and the resposibility of migrating the plugin lies upon me.
Since I am new to Intellij plugin development field, I am facing hell lot of difficulty as there is neither java docs or proper documentation nor any kind of tutorial. I tried looking into API of 5.0 and it contains no description at all. I have read the architecture and various other documentation available at (http://confluence.jetbrains.net/display/IDEADEV/PluginDevelopment) .
Is there any other way I can expedite the process other than looking for individual queries posted in confluence and make desperate try of bringing any sense how so ever little I can.

Appreciate the prompt replies I have got till now

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



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Thanks Nikoly for the prompt and useful reply. Dont know how will I manage without you. Hopefully one last thing, I have created the java module and added web facet to it using
   
   FacetType type = FacetTypeRegistry.getInstance().findFacetType(WebFacet.ID);
            FacetManager.getInstance(webModule).addFacet(type, moduleName, null);            
            Collection facets = WebFacet.getInstances(webModule);
            if(facets.size() > 0)
            {
                Iterator iterator = facets.iterator();
                WebFacet webFacet = (WebFacet)iterator.next();
                webFacet.getDescriptorsContainer().getConfiguration().addConfigFile(DeploymentDescriptorsConstants.WEB_XML_META_DATA,webModuleRoot.getAbsolutePath() + "\\WEB-INF\\web.xml");
            }


but when I module is created in IntelliJ, it still ask for web facet to be attached to it. Is there something I am doing wrong. And when I manually do it then the icon for module changes to web but when done through the plug-in the icon besides the module is still that of java project.

0
Comment actions Permalink

What do you mean by "it still ask for web facet"? Your code should add a Web facet to any existing Java module regardless of how this module was
created (by user or via API). Also a web facet added to a module doesn't change icon of that module. It will be shown as a separate node under the
module node in Project Structure dialog.

Thanks Nikoly for the prompt and useful reply. Dont know how will I manage without you. Hopefully one last thing, I have created the java module and added web facet to it using
+  +
+   FacetType type = FacetTypeRegistry.getInstance().findFacetType(WebFacet.ID);
            FacetManager.getInstance(webModule).addFacet(type, moduleName, null);           
            Collection facets = WebFacet.getInstances(webModule);
            if(facets.size() > 0)
            {
                Iterator iterator = facets.iterator();
                WebFacet webFacet = (WebFacet)iterator.next();
                webFacet.getDescriptorsContainer().getConfiguration().addConfigFile(DeploymentDescriptorsConstants.WEB_XML_META_DATA,webModuleRoot.getAbsolutePath() + "
WEB-INF
web.xml");
            }+

but when I module is created in IntelliJ, it still ask for web facet to be attached to it. Is there something I am doing wrong. And when I manually do it then the icon for module changes to web but when done through the plug-in the icon besides the module is still that of java project.

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



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Thanks Nikolay for your instant replies. Well, Once I have added the Web Facet to Java Module, when I work in IntelliJ 9, the notification tab ask through the pop up that whether the same module to be added as web face? screen shot is attached as well



Attachment(s):
screen-shot.JPG
0
Comment actions Permalink

These notifications come from automatic facet detection. When IDEA see web.xml file somewhere in sources it suggest you to create a Web Facet for that
file. However if you've already created a Web facet for that web.xml via API the notification should not be shown for that file.

Thanks Nikolay for your instant replies. Well, Once I have added the Web Facet to Java Module, when I work in IntelliJ 9, the notification tab ask through the pop up that whether the same module to be added as web face? screen shot is attached as well

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


------------------------------------------------------------------------



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.