The goal I proposed is completely optional, and I don't think it conflicts with the specification. The packaging just puts all the *.class files into a JAR under WEB-INF/lib instead of leaving them in WEB-INF/classes.


Anyway I checked the Servlet Spec 2.4 and I found the following under SRV 9.5 Directory Structure :
"The contents of the WEB-INF directory are:
• The/WEB-INF/web.xmldeployment descriptor.
• The/WEB-INF/classes/ directory for servlet and utility classes. The classes in this directory must be available to the application class loader.
• The/WEB-INF/lib/*.jar area for Java Archive files. These files contain servlets, beans, and other utility classes useful to the Web application. The Web application class loader must be able to load classes from any of these archive files.
The Web application class loader must load classes from the WEB-INF/classes directory first, and then from library JARs in the WEB-INF/lib directory. Also, any requests from the client to access the resources in WEB-INF/ directory must be returned with aSC_NOT_FOUND(404) response. "


It seems therefore allowed to put servlets and other resources in JARs and even have an empty WEB-INF/classes directory.

However I fully understand that this patch might not have it's place in the WAR plugin although I think it might (I don't really see where else to put it), but I was just proposing it in case somebody was interested in this functionality.

Regards,
  Serge Huber.

On Aug 12, 2004, at 6:58 PM, Carlos Sanchez wrote:

Hi,

You can raise a feature request in JIRA, but IMHO this patch is not a good
idea as including *.class in /WEB-INF/classes just follows the webapp
specification.


Regards

Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net


-----Original Message-----
From: Serge Huber [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 12, 2004 5:41 PM
To: [EMAIL PROTECTED]
Subject: Improvements suggestion for WAR plugin


Hi all,

Here is a quick & dirty suggestion for the WAR plugin for
those of you who don't want to package WAR files with tons of
stuff in the WEB-INF/classes directory. This little preGoal
will allow you to package either just the *.class files into
a JAR, or the whole content of the WEB-INF/classes directory.

First of all here are the properties :

# set to true if you want the contents of WEB-INF/classes to
be packaged into a JAR in WEB-INF/lib
maven.war.jarclasses=true # the name of the JAR in
WEB-INF/lib
maven.war.jarclasses.name=${pom.artifactId}-${pom.currentVersion}.jar
# set to true if you only want the *.class files in the JAR,
false will include the whole contents of WEB-INF/classes
maven.war.jarclasses.justclasses=true

Here is the preGoal :

   <preGoal name="war:war">
     <j:set var="mavenWarJarClasses" value="${maven.war.jarclasses}"/>
     <j:set var="mavenWarJarClassesJustClasses"
value="${maven.war.jarclasses.justclasses}"/>
     <j:set var="mavenWarJarClassesName"
value="${maven.war.jarclasses.name}"/>
     <j:if test="${mavenWarJarClasses == 'true'}" trim="true">
       <j:choose>

         <j:when test="${mavenWarJarClassesJustClasses ==
'true'}" trim="true">
           <jar
destfile="${maven.build.dir}/${pom.artifactId}/WEB-INF/lib/${m
avenWarJarClassesName}"

basedir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes"
                includes="**/*.class"
           />
           <!-- we do all this mess because the delete
includeEmptyDirs doesn't seem to work in Ant :( -->
           <copy includeEmptyDirs="false"
toDir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes_ju
stresources">
             <fileset
dir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes">
               <exclude name="**/*.class"/>
             </fileset>
           </copy>
           <delete
dir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes" />
           <move
todir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes">
             <fileset
dir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes_just
resources"/>
           </move>
         </j:when>

         <j:otherwise>
           <jar
destfile="${maven.build.dir}/${pom.artifactId}/WEB-INF/lib/${m
avenWarJarClassesName}"

basedir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes"
                includes="**/*"
           />
           <delete
dir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes" />
           <mkdir
dir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes" />
         </j:otherwise>

       </j:choose>
     </j:if>
   </preGoal>

I hope this could be included into the WAR plugin as it is
very useful to me and maybe to others. How should this
happen, can someone take this up or should I try to modify
the plugin myself. Please be informed my Jelly knowledge is
*very* limited.

Regards,
   Serge Huber.


- -- --- -----=[ shuber2 at jahia dot com ]=---- --- -- - www.jahia.org : A collaborative source CMS and Portal Server



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to