shuber 2004/09/10 15:07:41 CEST
Added files:
. maven.xml plugin.jelly plugin.properties
project.xml
Log:
Initial commit of Maven plugin to package WARs "� la sauce de chez nous" :)
Revision Changes Path
1.1 +7 -0 maven-jahiawar-plugin/maven.xml (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/maven-jahiawar-plugin/maven.xml?rev=1.1&content-type=text/plain
1.1 +146 -0 maven-jahiawar-plugin/plugin.jelly (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/maven-jahiawar-plugin/plugin.jelly?rev=1.1&content-type=text/plain
1.1 +25 -0 maven-jahiawar-plugin/plugin.properties (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/maven-jahiawar-plugin/plugin.properties?rev=1.1&content-type=text/plain
1.1 +159 -0 maven-jahiawar-plugin/project.xml (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/maven-jahiawar-plugin/project.xml?rev=1.1&content-type=text/plain
Index: maven.xml
====================================================================
<project default="plugin:plugin"
xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:artifact="artifact"
xmlns:ant="jelly:ant">
</project>
Index: plugin.jelly
====================================================================
<project default="java:jar"
xmlns:j="jelly:core"
xmlns:define="jelly:define"
xmlns:maven="jelly:maven"
xmlns:ant="jelly:ant"
xmlns:jasper="jasper"
xmlns:util="jelly:util">
<define:taglib uri="jasper">
<define:jellybean
name="JspC"
className="org.apache.jasper.JspC"
method="execute"
/>
</define:taglib>
<preGoal name="war:webapp">
<j:set var="precompileJsp" value="${maven.jahiawar.precompile.jsp}"/>
<j:if test="${precompileJsp == 'true'}">
<attainGoal name="jahia:precompile-jsp"/>
</j:if>
</preGoal>
<postGoal name="war:webapp">
<j:set var="precompileJsp" value="${maven.jahiawar.precompile.jsp}"/>
<j:if test="${precompileJsp == 'true'}">
<j:set var="target"
value="${pom.getPluginContext('maven-war-plugin').getVariable('maven.war.webapp.dir')}"/>
<util:available file="${maven.build.dir}/web-fragment.xml">
<util:loadText var="fragment" file="${maven.build.dir}/web-fragment.xml"/>
<ant:replace file="${target}/WEB-INF/web.xml" token="<!-- [INSERT
FRAGMENT HERE] -->" value="${fragment}"/>
</util:available>
</j:if>
<j:set var="useSharedLibs" value="${maven.jahiawar.usesharedlibs}"/>
<j:if test="${useSharedLibs == 'true'}">
<delete>
<fileset dir="${maven.build.dir}/${pom.artifactId}/WEB-INF/lib"
includes="${maven.jahiawar.usesharedlibs.list}" />
</delete>
</j:if>
</postGoal>
<goal name="jahia:precompile-jsp" description="Precompile all JSPs into java
classes, and then into classes" prereqs="war:load,java:compile">
<j:set var="warSource"
value="${pom.getPluginContext('maven-war-plugin').getVariable('maven.war.src')}"/>
<ant:mkdir dir="${maven.build.dir}/jspc"/>
<ant:mkdir dir="${maven.build.dir}/jspc-processed"/>
<ant:mkdir dir="${maven.build.dir}/jspc-classes"/>
<j:set var="jspOutDir" value="${maven.build.dir}/jspc"/>
<j:set var="jspClassesOutDir" value="${maven.build.dest}"/>
<ant:path id="jspc.classpath">
<echo message="Java home=${java.home}" />
<ant:pathelement location="${java.home}/../lib/tools.jar"/>
<ant:fileset dir="${catalina.home.dir}/bin">
<ant:include name="*.jar"/>
</ant:fileset>
<ant:fileset dir="${catalina.home.dir}/server/lib">
<ant:include name="*.jar"/>
</ant:fileset>
<ant:fileset dir="${catalina.home.dir}/common/lib">
<ant:include name="*.jar"/>
</ant:fileset>
<ant:path refid="maven.dependency.classpath"/>
<ant:pathelement path="${maven.build.dest}"/>
</ant:path>
<jasper:JspC
webXmlFragment="${maven.build.dir}/web-fragment.xml"
package="${pom.package}.jsp.${maven.war.final.name}"
outputDir="${jspOutDir}"
srcdir="${warSource}"
uriroot="${warSource}"
uribase="/${pom.artifactId}"
verbose="2"/>
<ant:javac
srcdir="${jspOutDir}"
destdir="${jspClassesOutDir}"
debug="${maven.compile.debug}"
deprecation="${maven.compile.deprecation}"
optimize="${maven.compile.optimize}"
classpathref="jspc.classpath"/>
</goal>
<preGoal name="war:war">
<j:set var="mavenJahiaWARJarClasses" value="${maven.jahiawar.jarclasses}"/>
<j:set var="mavenJahiaWARJarClassesJustClasses"
value="${maven.jahiawar.jarclasses.justclasses}"/>
<j:set var="mavenJahiaWARJarClassesName"
value="${maven.jahiawar.jarclasses.name}"/>
<j:if test="${mavenJahiaWARJarClasses == 'true'}" trim="true">
<j:choose>
<j:when test="${mavenJahiaWARJarClassesJustClasses == 'true'}" trim="true">
<jar
destfile="${maven.build.dir}/${pom.artifactId}/WEB-INF/lib/${mavenJahiaWARJarClassesName}"
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 :( -->
<mkdir
dir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes_justresources"/>
<copy includeEmptyDirs="false"
toDir="${maven.build.dir}/${pom.artifactId}/WEB-INF/classes_justresources">
<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_justresources"/>
</move>
</j:when>
<j:otherwise>
<jar
destfile="${maven.build.dir}/${pom.artifactId}/WEB-INF/lib/${mavenJahiaWARJarClassesName}"
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>
<goal name="jahia:war">
<attainGoal name="war:war" />
</goal>
<!-- ================================================================ -->
<!-- Deploy to Catalina and Expand -->
<!-- ================================================================ -->
<goal name="jahia:hotdeploy-tomcat">
<attainGoal name="war:webapp"/>
<echo message="Hot deploying ${pom.id}, ${pom.name}"/>
<copy
todir="${maven.jahiawar.deploy.war.dir}/${maven.jahiawar.deploy.context.name}">
<fileset dir="${maven.build.dir}/${pom.artifactId}"/>
</copy>
</goal>
<goal name="jahia:deploy-tomcat">
<attainGoal name="war:war"/>
<echo message="Deploying ${pom.id}, ${pom.name}"/>
<delete
dir="${maven.jahiawar.deploy.war.dir}/${maven.jahiawar.deploy.context.name}"/>
<!--copy file="${maven.build.dir}/${pom.artifactId}.war"
tofile="${maven.jahiawar.deploy.war.dir}/${pom.artifactId}.war"/-->
<unwar src="${maven.build.dir}/${maven.war.final.name}"
dest="${maven.jahiawar.deploy.war.dir}/${maven.jahiawar.deploy.context.name}"/>
</goal>
</project>
Index: plugin.properties
====================================================================
# Settings for preGoal for packaging of WEB-INF/classes into a JAR in WEB-INF/lib
# set to true if you want the contents of WEB-INF/classes to be packaged into a JAR
in WEB-INF/lib
maven.jahiawar.jarclasses=true
# the name of the JAR in WEB-INF/lib
maven.jahiawar.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.jahiawar.jarclasses.justclasses=true
# the name of the context under which to deploy the application.
maven.jahiawar.deploy.context.name=${pom.artifactId}
maven.war.final.name=${maven.jahiawar.deploy.context.name}.war
# remove this if you want to include JSPs.
maven.war.src.excludes=**/*.jsp
# Set to true if you want JSP precompilation to happen after war:webapp goal
maven.jahiawar.precompile.jsp=true
# Set to true if you want to exclude some libraries from packaging, which will
usually be then inserted as shared libraries.
maven.jahiawar.usesharedlibs=false
# The list of JARs to exclude from the final WAR package.
maven.jahiawar.usesharedlibs.list=antlr*.jar,commons-beanutils*.jar,commons-collections*.jar,commons-dbcp*.jar,commons-logging*.jar,commons-pool*.jar,hsql*.jar,jcs*.jar,jdom*.jar,log4j*.jar,mysql*.jar,p6spy*.jar,torque*.jar,velocity*.jar,xercesImpl*.jar,xml-apis*.jar
# Tomcat deployment locations
maven.jahiawar.deploy.war.dir=${catalina.home.dir}/webapps/
Index: project.xml
====================================================================
<?xml version="1.0" encoding="UTF-8"?>
<project>
<extend>${basedir}/../common-jahiaprojects/project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-jahiawar-plugin</id>
<groupId>jahia</groupId>
<name>Jahia Web application packaging Plugin</name>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<description>
Plugin for assisting with packaging of web applications the way it's usually
done in Jahia.
</description>
<shortDescription>Jahia Packaging Plugin</shortDescription>
<dependencies>
<!-- Dependencies required for JSP precompilation -->
<dependency>
<groupId>tomcat</groupId>
<artifactId>catalina-ant</artifactId>
<version>5.0.18</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler</artifactId>
<version>5.0.18</version>
</dependency>
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-runtime</artifactId>
<version>5.0.18</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.3</version>
</dependency>
<!--dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.0</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency-->
<dependency>
<groupId>commons-el</groupId>
<artifactId>commons-el</artifactId>
<version>1.0</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<!--dependency>
<groupId>commons-daemon</groupId>
<artifactId>commons-daemon</artifactId>
<version>SNAPSHOT</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.2.1</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency-->
<dependency>
<groupId>servletapi</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4-20040521</version>
<!--properties>
<classloader>root</classloader>
</properties-->
<type>jar</type>
</dependency>
<dependency>
<groupId>jspapi</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0-20040521</version>
<!-- don't understand why I need root but throws class not found otherwise -->
<properties>
<classloader>root</classloader>
</properties>
<type>jar</type>
</dependency>
<!--dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.1</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency-->
</dependencies>
<build>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<resources>
<resource>
<directory>${basedir}/src/plugin-resources</directory>
<targetPath>plugin-resources</targetPath>
</resource>
<resource>
<directory>${basedir}</directory>
<includes>
<include>plugin.jelly</include>
<include>plugin.properties</include>
<include>project.properties</include>
<include>project.xml</include>
<include>locator.ent</include>
</includes>
</resource>
</resources>
</build>
<reports>
<report>maven-jdepend-plugin</report>
<!--
<report>maven-checkstyle-plugin</report>
-->
<report>maven-pmd-plugin</report>
<report>maven-changelog-plugin</report>
<report>maven-file-activity-plugin</report>
<report>maven-developer-activity-plugin</report>
<report>maven-license-plugin</report>
<report>maven-javadoc-plugin</report>
<report>maven-jxr-plugin</report>
<report>maven-junit-report-plugin</report>
<!--
<report>maven-linkcheck-plugin</report>
-->
<report>maven-tasklist-plugin</report>
</reports>
</project>