facebook

How are web projects packaged?

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #242672 Reply

    NeutronIC
    Member

    Now that i’ve got my web app building under MyEclipse (or at least parsing fully with only expected warnings coming out) I tried to deploy to a war file in to Tomcat to see what it would produce. I wasn’t expecting 100%, and it hasn’t done bad at all – indeed, the bit I thought it would have difficulty with was great and the bit I expected to be easy didn’t happen 🙂

    A reminder of our project folder layout:

    /vsbuild/projects/mywebapp
    -> Root of the project

    /vsbuild/projects/mywebapp/src
    -> Class source code

    /vsbuild/projects/mywebapp/web
    -> the web root

    Libs are in their own place, dependant projects are side-by-side, all the libs and dependant projects are registered correctly in the class path.

    The resultant WAR file is quite simple:

    WEB-INF/lib – populated with all dependant JAR’s and projects packaged up as JAR’s, looks great.

    But that’s it…

    Under ‘web’ in the project structure there’s a bunch of stuff such as other folders, plenty of TLD and JSP files, web.xml and so forth. In addition, we have an /etc/deploy folder with properties that should end up in the WEB-INF/classes folder and equally all the supporting classes themselves – none of which make it in to the WAR file.

    One wrinkle is that I have the output path for the classes set to our standard build output, I don’t want to “corrupt” the WEB-INF/classes folder with binaries as it is part of the source structure.

    Is there some way, or could the system be tweaked to accomodate it such that you can tell it to pull the classes from the class output folder rather than relying on them being put in the “correct” place?

    That solves the config and classes part of the problem potentially, however I am still at a loss to learn where my JSP’s etc are ending up.

    E.g.

    web
    web/graphics
    web/secure
    web/secure/common
    web/secure/scripts
    web/WEB-INF
    web/WEB-INF/jsp

    None of the above make it in to the WAR, in fact it seems to be ignoring the web root altogether, I wonder if it’s still expecting it to all be in WebRoot ?

    Under MyEclipse-Web, the Web-root folder is set to /web (i’ve also tried without the slash).

    I’ve also tried changing the IDE default to /web.

    Running re-deploy and watching the names flash past I am sure I can see it looks like it’s processing the .class files from the build output, but they don’t seem to end up in the WAR – unless this is doing something with the other projects.

    Any help greatly appreciated.

    Matt.

    #242715 Reply

    Riyad Kalla
    Member

    Is there some way, or could the system be tweaked to accomodate it such that you can tell it to pull the classes from the class output folder rather than relying on them being put in the “correct” place?

    Not currently. I think the reason you are having this problem is because you are putting source code in your /classes dir, which it shouldn’t really contain. Whenever you have a source file, like a .properties file, or .xml file that needs to end up in an output dir, but is itself not compilable, it should go into a source tree within the project in the proper location. For example, with hibernate XML files, they don’t go in the output dir, they go into the source tree and are copied out into the output dir at build time. This is why the default behavior of Eclipse is to erase the output dir before a build, it is assumed no files live there. If you made this adjustment things might be easier.

    Under MyEclipse-Web, the Web-root folder is set to /web (i’ve also tried without the slash).

    Leave it as ‘web’ (without the quotes and no slash)

    Matt,
    try and open your log file, <workspace dir>\.metadata\.log, and look for exceptions that might have occured during deployment. To make things easier, shut down MyEclipse, erase that log file, restart MyEclipse and redeploy your project, then check the log file (if it exists) and paste the exceptions here for us.

    #242735 Reply

    NeutronIC
    Member

    Hi,

    Thanks for the feedback, made some progress last night.

    The ommission of all the files except lib etc was down to an exclusion filter i’d put on the classpath, it helps the apps greatly but isn’t needed at all with webapps so removing that made all the files suddenly appear in the resultant WAR.

    The only issue left is simply the missing class files generated from the web app itself.

    It’s not so much the classes folder that has source – indeed I don’t have a classes folder, it’s the WEB-INF folder that I ‘consider’ to be source.

    Config files for deployment go in to /etc/deploy, source code is in /src, the web inf would be in /web/WEB-INF and while web-inf contains source such as web.xml (as it should), I don’t have any libs or classes in there at all.

    It would be greatly handy if you could consider adding some option whereby the output folder for the project is used as the folder to become the classes folder in the deployment.

    I’ve been reluctant to have the WEB-INF/classes folder used within eclipse because our build system just pulls the whole web-inf structure across, but thinking about it, it shouldn’t be hard to simply tell it to exclude the classes folder from that copy process and then Eclipse can go ahead and use it freely.

    The deployment isn’t perfect by any means, but all it has to do is be runnable for debugging and testing purposes – and from that perspective it’s not far off now. The build system itself will produce the final distributables.

    I shall go forth and play 🙂

    Thanks for your help, as usual, much appreciated.

    Matt.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How are web projects packaged?

You must be logged in to post in the forum log in