blob: b7f66ef6e4254bb4d4cfafc3eb6f74b213b72a86 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- ======================================================================
OFBiz -> JBoss 4.2.2 Installer
====================================================================== -->
<project name="OfBiz JBoss" default="generate">
<description>
Create the ear file to run OfBiz in Jboss
</description>
<property name="DERBY_VERSION" value="10.4.2.0"/>
<property name="ofbizHome" location="${ofbizHome}/"/>
<!-- =================================
target: generate
================================= -->
<target name="generate" depends="installDerby" description="--> Create the ear file to run OfBiz in Jboss"/>
<!-- - - - - - - - - - - - - - - - - -
target: clean
- - - - - - - - - - - - - - - - - -->
<target name="clean">
<delete failonerror="false">
<fileset dir="./META-INF/">
<include name="**/**"/>
</fileset>
</delete>
<delete failonerror="false">
<fileset dir=".">
<include name="lib/** *.war"/>
</fileset>
</delete>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: installDerby
- - - - - - - - - - - - - - - - - -->
<target name="installDerby" depends="clean">
<!-- install derby -->
<copy file="${r"${ofbizHome}"}/framework/entity/lib/jdbc/derby-${r"${DERBY_VERSION}"}.jar" todir="../../lib/"/>
<!-- install derby plugin -->
<copy file="../../../../docs/examples/varia/derby-plugin.jar" todir="../../lib/"/>
<!-- install derby datasource -->
<copy todir=".">
<fileset dir="${r"${ofbizHome}"}/framework/appserver/templates/jboss422/patches/">
<include name="derby*.xml"/>
</fileset>
</copy>
<!-- move entityengine.xml, log4j.xml and jndi.properties -->
<move file="${r"${ofbizHome}"}/framework/entity/config/entityengine.xml" tofile="${r"${ofbizHome}"}/framework/entity/config/entityengine.xml.jbak"/>
<move file="${r"${ofbizHome}"}/framework/entity/config/entityengine-jboss422.xml" tofile="${r"${ofbizHome}"}/framework/entity/config/entityengine.xml"/>
<move file="${r"${ofbizHome}"}/framework/base/config/log4j.xml" tofile="${r"${ofbizHome}"}/framework/base/config/_log4j.xml.bak"/>
<move file="${r"${ofbizHome}"}/framework/base/config/jndi.properties" tofile="${r"${ofbizHome}"}/framework/base/config/_jndi.properties.bak"/>
<!-- copy all lib files -->
<mkdir dir="lib"/>
<copy todir="./lib" flatten="true">
<fileset dir="${r"${ofbizHome}"}">
<#list classpathJars as jar>
<#assign fullJarName = jar?j_string />
<#assign jarname = (fullJarName?substring(ofbizHome?length +1))?j_string/>
<include name="${jarname}"/>
</#list>
<exclude name="**/*j2eespec*.jar"/>
<exclude name="**/*geronimo*.jar"/>
<exclude name="**/*catalina*.jar"/>
<exclude name="**/*tomcat*.jar"/>
<exclude name="**/*mx4j*.jar"/>
<exclude name="**/*derby-*.jar"/>
<exclude name="**/*commons-logging*.jar"/>
<exclude name="**/*commons-collections*.jar "/>
<exclude name="**/*commons-codec*.jar"/>
<exclude name="**/*commons-el*.jar"/>
<exclude name="**/*avalon-framework*.jar"/>
<exclude name="**/*bsh*.jar"/>
<exclude name="**/*bsf*.jar"/>
<exclude name="**/*antlr*.jar"/>
<exclude name="**/*mail*.jar"/>
<exclude name="**/*xerces*.jar"/>
<exclude name="**/*xalan*.jar"/>
</fileset>
</copy>
<#list classpathDirs as dir>
<#if (dir != ofbizHome)>
<#assign dirname = dir?substring((ofbizHome?j_string)?length +1) />
<#assign dirname = dirname?replace("/", ".", "r")/>
<jar destfile="./lib/${dirname}.jar">
<fileset dir="${dir}">
<include name="**/**"/>
</fileset>
</jar>
</#if>
</#list>
<!-- link the web applications -->
<#list webApps as webapp>
<copy todir=".${webapp.getContextRoot()}.war">
<fileset dir="${webapp.getLocation()}"/>
</copy>
</#list>
<!-- create the application meta data -->
<mkdir dir="META-INF"/>
<copy file="${targetDirectory}/application.xml" todir="./META-INF"></copy>
<copy file="${r"${ofbizHome}"}/framework/base/lib/scripting/bsh-2.0b4.jar" tofile="../../lib/bsh.jar"/>
<!-- revert entityengine.xml log4j.xml and jndi.properties -->
<move file="${r"${ofbizHome}"}/framework/entity/config/entityengine.xml" tofile="${r"${ofbizHome}"}/framework/entity/config/entityengine-jboss422.xml"/>
<move file="${r"${ofbizHome}"}/framework/entity/config/entityengine.xml.jbak" tofile="${r"${ofbizHome}"}/framework/entity/config/entityengine.xml"/>
<move file="${r"${ofbizHome}"}/framework/base/config/_log4j.xml.bak" tofile="${r"${ofbizHome}"}/framework/base/config/log4j.xml"/>
<move file="${r"${ofbizHome}"}/framework/base/config/_jndi.properties.bak" tofile="${r"${ofbizHome}"}/framework/base/config/jndi.properties"/>
<!-- setup the OFBIZ_HOME by updating run.conf -->
<move file="../../../../bin/run.conf" tofile="../../../../bin/run.conf.obak"/>
<copy file="${r"${ofbizHome}"}/setup/jboss422/run.conf" tofile="../../../../bin/run.conf"/>
</target>
</project>