Exploded directory

Hi,

can anybody explain me the purpose of "exploded directory"?

I am new to JEE, using Glassfish 9.1. I am able to deploy my web application via creating and deploying war file from Idea. But I don't want to deploy whole project when only changing a small part of my JSP file.

So I enabled "exploded directory", auto reload in glassfish but how to force glassfish to deploy files from my exploded directory?

I set the path of exploded directory to glassfish_install_dir/domains/domain1/applications/j2ee-modules/mywebapp so IDEA can copy every change directly do Glassfish but I consider it only the horrible hack.

Thank you

9 comments
Comment actions Permalink

The easiest way I found (at least using tomcat) was to set the exploded directory to be the same as the web content directory. This way, the server is started with the files from the web content directory, and no deployment is actually needed for the jsp files (as soon as a file saved, the server would pick it up).

You might end up with some class files and/or jars in your META-INF/classes or META-INF/lib directories (for the other classes of your project, depending on how you have set the web module stuff), but they're not causing any harm (and you can set those subdirectories to be ignored, if you don't want to see them at all in IDEA).

HTH,
Andrei

0
Comment actions Permalink

Does it mean that your exploded dir points directly to weapps folder in the tomcat installation tree?

0
Comment actions Permalink

if I understand Andrei correctly he does not use the synchronization feature for the exploded directory, at least this is how I typically set up my projects. My project structure looks something like this


project_root
--src
--web
-


img
-


css
-


WEB-INF
-


lib
-


classes
-


jsp
-


tags
-


...
-


[other web resource stuff]
--doc
--[other stuff]

In IDEA, set the Web Resource Directory (in your web module settings) to ]]>/web, and under Java EE Build Settings/Web Module Exploded Directory enable 'Create web module exploded directory' and set the path to the same directory. Do not enable 'Exclude from module content' and 'Synchronize exploded directory'. Set the compiler output directory to /web/WEB-INF/classes. To run your project use the tomcat plugin or add a context entry in your tomcat configuration that points to your ]]>/web directory.

hth werner

0
Comment actions Permalink

Ok, I understand...thank you

Little offtopic: do you know how to make it work with Sun's application server?

0
Comment actions Permalink

I'm sorry, I have absolutely no experience with Sun's Java Web Server. Did some googling and found this link:

http://forum.java.sun.com/thread.jspa?threadID=5110115&tstart=150

0
Comment actions Permalink

GlassFish is Sun's Open Source Java EE 5 application server, it's not Sun's Web Server.

GlassFish has an autodeploy directory, but it expects archives to be placed there, not "exploded" archives. Maybe you can have the tool generate the war straight in that directory. Make sure auto-deploy is enabled, from the Web UI => App Server => Advanced => Reload needs to be enabled (default is poll interval is 2 seconds).

0
Comment actions Permalink

yes, but there si still need to deploy application everytime I make even little change to JSP file.

Is it possible to say Glassfish to "load" my application from exploded directory withiin my IDEA project located somewhere in Documents? (to be able to see changes in JSPs right after save)

0
Comment actions Permalink

well, if GlassFish only supports expanded web apps within its specific deployment directory I would go for IDEA's synchronization feature for exploded directories. I think this is what you described in your first post. I would not consider it a hack since it seems to be supported for development setups (see link below) and IDEA does a pretty good job of keeping the directories in sync. Just build the project and IDEA copies all modified files to the exploded directory - this is actually pretty fast.
This is probably a lot faster than any solution that involves creating and unpacking the war file on each change.

Only other solution I can think of is to symlink your project directory to the appropriate directory in the GlassFish deployment directory, or use both a synchronized exploded directory that is updated by idea and link these directories to the glassfish directory.

werner

GlassFish expanded directory deployment doc:
https://glassfish.dev.java.net/javaee5/deployment/#0.0.0.0.Packaging%20Applications%20for%20Deployment%7Coutline

0
Comment actions Permalink

Ok, my hack seems not to be a hack but a preferable and effective solution ;)

Thank you

0

Please sign in to leave a comment.