| <!-- |
| |
| Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. |
| |
| This program and the accompanying materials are made available under the |
| terms of the Eclipse Public License v. 2.0, which is available at |
| http://www.eclipse.org/legal/epl-2.0. |
| |
| This Source Code may also be made available under the following Secondary |
| Licenses when the conditions for such availability set forth in the |
| Eclipse Public License v. 2.0 are satisfied: GNU General Public License, |
| version 2 with the GNU Classpath Exception, which is available at |
| https://www.gnu.org/software/classpath/license.html. |
| |
| SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| |
| --> |
| |
| <!-- |
| This is the top level persistence build file that should be |
| imported into all the leaf level persistence build files |
| --> |
| |
| <!-- |
| -Ddatabase.properties option can be passed to the ant target to run the persistence |
| tests with various databases. Test loads derby.properties as default if no database |
| is specified. |
| --> |
| <property name="database.properties" value="${env.APS_HOME}/devtests/persistence/config/derby.properties" /> |
| <property file="${database.properties}" /> |
| |
| <!-- |
| -Dpersistence.provider option can be passed to the ant target to run the persistence |
| tests with various providers. Test loads eclipselink as default if no provider |
| is specified. |
| --> |
| <property name="persistence.provider" value="org.eclipse.persistence.jpa.PersistenceProvider" /> |
| |
| <!-- |
| oracle-setup target is defined for copying the oracle drivers to the appserver lib |
| dir. |
| --> |
| <target name="database-setup" depends="init-common"> |
| <echo message="So you are using oracle..!"/> |
| <antcall target="copyDrivers"> |
| <param name="db.driver.dir" value="${db.driver.dir}"/> |
| <param name="db.driver" value="${db.driver}"/> |
| </antcall> |
| </target> |
| |
| |
| <target name="copyDrivers" depends="init-common"> |
| <echo message="db.driver.dir=${db.driver.dir}"/> |
| <echo message="db.driver=${db.driver}"/> |
| <copy todir="${admin.domain.dir}/${admin.domain}/lib/ext" |
| overwrite="true" failonerror="false"> |
| <fileset dir="${db.driver.dir}" includes="**/*.jar"/> |
| </copy> |
| <antcall target="restart-server-instance-common"/> |
| </target> |
| |
| <!-- ================================================================ --> |
| <!-- Target to create JDBC connection pool --> |
| <!-- ================================================================ --> |
| <target name="create-jdbc-persistence-connpool-common" depends="init-common"> |
| <echo message="created jdbc connection pool ${jdbc.conpool.name}" |
| level="verbose"/> |
| <property name="extra-params" value=""/> |
| <exec executable="${ASADMIN}" failonerror="false"> |
| <arg line="create-jdbc-connection-pool"/> |
| <arg line="--datasourceclassname ${db.class}"/> |
| <arg line="--restype ${jdbc.resource.type}"/> |
| <arg line="${extra-params}"/> |
| <arg line="--target ${appserver.instance.name}"/> |
| <arg line="${as.props}"/> |
| <arg line="--property ${db.driver.props}"/> |
| <arg line="${jdbc.conpool.name}"/> |
| </exec> |
| </target> |
| |
| <!-- ===== package PU ===== --> |
| <target name="package-pu-common" depends="init-common"> |
| <echo message="${build.classes.dir}, ${assemble.dir}, ${persistence.xml}"/> |
| <mkdir dir="${assemble.dir}"/> |
| <delete file="${entity.jar}" failonerror="false"/> |
| <mkdir dir="${build.classes.dir}/META-INF"/> |
| <copy file="${persistence.xml}" tofile="${build.classes.dir}/META-INF/persistence.xml" failonerror="false"/> |
| <jar jarfile="${assemble.dir}/${entity.jar}" basedir="${build.classes.dir}" update="true" includes = "${entityjar.classes}"> |
| <metainf dir="${build.classes.dir}/META-INF"> |
| <include name="**/*.xml"/> |
| </metainf> |
| </jar> |
| <delete dir="${build.classes.dir}/META-INF" failonerror="false"/> |
| </target> |
| |
| <!-- ===== package entity classes without PU ===== --> |
| <target name="package-entity-common" depends="init-common"> |
| <echo message="${build.classes.dir}, ${assemble.dir}, ${persistence.xml}"/> |
| <mkdir dir="${assemble.dir}"/> |
| <delete file="${entity.jar}" failonerror="false"/> |
| <mkdir dir="${build.classes.dir}/META-INF"/> |
| <jar jarfile="${assemble.dir}/${entity.jar}" basedir="${build.classes.dir}" update="true" includes = "${entity.class}"> |
| <metainf dir="${build.classes.dir}/META-INF"> |
| <include name="**/*.xml"/> |
| </metainf> |
| </jar> |
| <echo message="----GENERATED----${build.classes.dir}/${entity.jar}" /> |
| <delete dir="${build.classes.dir}/META-INF" failonerror="false"/> |
| </target> |
| |
| <!-- ===== package PU under ear/lib===== --> |
| <target name="build-entity-earlib" depends="fixFiles,ejb-jar-common,appclient-jar-common,webclient-war-common"> |
| <delete file="${assemble.dir}/${appname}.ear"/> |
| <mkdir dir="${build.classes.dir}/META-INF"/> |
| <mkdir dir="${assemble.dir}/lib"/> |
| <move file="${assemble.dir}/entity.jar" todir="${assemble.dir}/lib"/> |
| <copy file="${application.xml}" |
| tofile="${build.classes.dir}/META-INF/application.xml" |
| failonerror="false"/> |
| <copy file="${glassfish-resources.xml}" |
| tofile="${build.classes.dir}/META-INF/glassfish-resources.xml" |
| failonerror="false"/> |
| <jar jarfile="${assemble.dir}/${appname}App.ear"> |
| <fileset dir="${assemble.dir}"> |
| <include name="**/*.jar"/> |
| <include name="*.war"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}"> |
| <include name="META-INF/application.xml"/> |
| <include name="META-INF/glassfish-resources.xml"/> |
| </fileset> |
| <fileset dir="${env.APS_HOME}" includes="lib/reporter.jar"/> |
| </jar> |
| </target> |
| |
| <!-- ===== build ear file ===== --> |
| <target name="build-ear-persistence" depends="fixFiles,webclient-war-common"> |
| <delete file="${assemble.dir}/${appname}.ear"/> |
| <mkdir dir="${assemble.dir}"/> |
| <mkdir dir="${build.classes.dir}/META-INF"/> |
| <copy file="${application.xml}" tofile="${build.classes.dir}/META-INF/application.xml" failonerror="false"/> |
| <jar jarfile="${assemble.dir}/${appname}App.ear"> |
| <fileset dir="${assemble.dir}"> |
| <include name="*.jar"/> |
| <include name="*.war"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}"> |
| <include name="META-INF/sun-application.xml"/> |
| <include name="META-INF/application.xml"/> |
| </fileset> |
| <fileset dir="${env.APS_HOME}" includes="lib/reporter.jar"/> |
| </jar> |
| </target> |
| |
| |
| <!-- ear file with webclient, and without appclient --> |
| <target name="build-pkg-ear" |
| depends="fixFiles,ejb-jar-common,webclient-war-local"> |
| <delete file="${assemble.dir}/${appname}.ear"/> |
| <mkdir dir="${assemble.dir}/lib"/> |
| <move file="${assemble.dir}/entity.jar" todir="${assemble.dir}/lib"/> |
| <mkdir dir="${build.classes.dir}/META-INF"/> |
| <copy file="${sun-application.xml}" |
| tofile="${build.classes.dir}/META-INF/sun-application.xml" |
| failonerror="false"/> |
| <copy file="${application.xml}" |
| tofile="${build.classes.dir}/META-INF/application.xml" |
| failonerror="false"/> |
| <jar jarfile="${assemble.dir}/${appname}App.ear"> |
| <fileset dir="${assemble.dir}"> |
| <include name="*.jar"/> |
| <include name="*.war"/> |
| <include name="lib/*.jar"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}"> |
| <include name="META-INF/sun-application.xml"/> |
| <include name="META-INF/application.xml"/> |
| </fileset> |
| </jar> |
| </target> |
| |
| |
| <!-- ear file with webclient, and without ejb/appclient --> |
| <target name="build-pu-ear" |
| depends="fixFiles,webclient-pu-war"> |
| <delete file="${assemble.dir}/${appname}.ear"/> |
| <mkdir dir="${assemble.dir}"/> |
| <mkdir dir="${assemble.dir}/lib"/> |
| <mkdir dir="${build.classes.dir}/META-INF"/> |
| <copy file="${sun-application.xml}" |
| tofile="${build.classes.dir}/META-INF/sun-application.xml" |
| failonerror="false"/> |
| <copy file="${application.xml}" |
| tofile="${build.classes.dir}/META-INF/application.xml" |
| failonerror="false"/> |
| <jar jarfile="${assemble.dir}/${appname}App.ear"> |
| <fileset dir="${assemble.dir}"> |
| <include name="*.jar"/> |
| <include name="*.war"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}"> |
| <include name="META-INF/sun-application.xml"/> |
| <include name="META-INF/application.xml"/> |
| </fileset> |
| </jar> |
| </target> |
| |
| <!-- make a war file with pu as WEB-INF/classes --> |
| |
| <target name="webclient-pu-war" |
| if="hasWebclient" depends="init-common"> |
| <mkdir dir="${assemble.dir}"/> |
| <antcall target="package-pu-war"> |
| <param name="war.file" value="${assemble.dir}/${appname}-web.war"/> |
| </antcall> |
| </target> |
| |
| <!-- make a war file with pu as WEB-INF/lib --> |
| <target name="webclient-pu-warlib" |
| if="hasWebclient" depends="init-common"> |
| <mkdir dir="${assemble.dir}"/> |
| <antcall target="package-pu-warlib"> |
| <param name="war.file" value="${assemble.dir}/${appname}-web.war"/> |
| </antcall> |
| </target> |
| |
| <!-- Build war file --> |
| <target name="webclient-war-local" |
| if="hasWebclient" depends="init-common"> |
| <mkdir dir="${assemble.dir}"/> |
| <antcall target="package-war-local"> |
| <param name="war.file" value="${assemble.dir}/${appname}-web.war"/> |
| </antcall> |
| </target> |
| |
| <!-- Build war file --> |
| <target name="package-war-local"> |
| <echo message="my build classes dir is:${build.classes.dir}"/> |
| <delete file="${war.file}"/> |
| <mkdir dir="${build.classes.dir}/WEB-INF/classes"/> |
| <echo message="webclient.war.classes=${webclient.war.classes}"/> |
| <copy file="${web.xml}" |
| tofile="${build.classes.dir}/WEB-INF/web.xml"/> |
| <copy todir="${build.classes.dir}/WEB-INF/classes"> |
| <fileset dir="${build.classes.dir}"> |
| <include name="${webclient.war.classes}"/> |
| </fileset> |
| </copy> |
| |
| <jar jarfile="${war.file}" basedir="${build.classes.dir}" |
| update="true" includes ="WEB-INF/classes/**"> |
| <fileset dir="${basedir}/docroot" casesensitive="yes"> |
| <include name="*.html"/> |
| <include name="*.jsp"/> |
| <include name="*.gif"/> |
| <include name="*.do"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}" casesensitive="true"> |
| <include name="WEB-INF/web.xml"/> |
| </fileset> |
| </jar> |
| <echo message="created war file ${war.file}"/> |
| <delete dir="${build.classes.dir}/WEB-INF" failonerror="false"/> |
| <echo message="my webclient war classes are:${webclient.war.classes}"/> |
| </target> |
| |
| |
| <!-- package pu under WEB-INF/classes --> |
| |
| <target name="package-pu-war" depends="init-common"> |
| <echo message="my build classes dir is:${build.classes.dir}"/> |
| <delete file="${war.file}"/> |
| <mkdir dir="${build.classes.dir}/WEB-INF/classes"/> |
| <echo message="webclient.war.classes=${webclient.war.classes}"/> |
| <copy file="${web.xml}" |
| tofile="${build.classes.dir}/WEB-INF/web.xml"/> |
| <mkdir dir="${build.classes.dir}/WEB-INF/classes/META-INF"/> |
| <copy file="${persistence.xml}" |
| tofile="${build.classes.dir}/WEB-INF/classes/META-INF/persistence.xml"/> |
| <copy todir="${build.classes.dir}/WEB-INF/classes"> |
| <fileset dir="${build.classes.dir}"> |
| <include name="**/*.class"/> |
| </fileset> |
| </copy> |
| |
| <jar jarfile="${war.file}" basedir="${build.classes.dir}" |
| update="true" includes ="WEB-INF/classes/**"> |
| <fileset dir="${basedir}/docroot" casesensitive="yes"> |
| <include name="*.html"/> |
| <include name="*.jsp"/> |
| <include name="*.gif"/> |
| <include name="*.do"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}" casesensitive="true"> |
| <include name="WEB-INF/web.xml"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}" casesensitive="true"> |
| <include name="WEB-INF/classes/META-INF/persistence.xml"/> |
| </fileset> |
| |
| </jar> |
| <echo message="created war file ${war.file}"/> |
| <delete dir="${build.classes.dir}/WEB-INF" failonerror="false"/> |
| <echo message="my webclient war classes are:${webclient.war.classes}"/> |
| </target> |
| |
| <!-- package pu under WEB-INF/lib --> |
| <target name="package-pu-warlib" depends="init-common"> |
| <echo message="my build classes dir is:${build.classes.dir}"/> |
| <delete file="${war.file}"/> |
| <mkdir dir="${build.classes.dir}/WEB-INF/classes"/> |
| <mkdir dir="${build.classes.dir}/WEB-INF/lib"/> |
| <echo message="webclient.war.classes=${webclient.war.classes}"/> |
| <copy file="${web.xml}" |
| tofile="${build.classes.dir}/WEB-INF/web.xml"/> |
| <mkdir dir="${build.classes.dir}/WEB-INF/classes/META-INF"/> |
| <move file="${assemble.dir}/entity.jar" todir="${build.classes.dir}/WEB-INF/lib"/> |
| |
| <copy todir="${build.classes.dir}/WEB-INF/classes"> |
| <fileset dir="${build.classes.dir}"> |
| <include name="**/*.class"/> |
| </fileset> |
| </copy> |
| |
| <jar jarfile="${war.file}" basedir="${build.classes.dir}" |
| update="true" includes ="WEB-INF/classes/**"> |
| <fileset dir="${basedir}/docroot" casesensitive="yes"> |
| <include name="*.html"/> |
| <include name="*.jsp"/> |
| <include name="*.gif"/> |
| <include name="*.do"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}" casesensitive="true"> |
| <include name="WEB-INF/web.xml"/> |
| </fileset> |
| <fileset dir="${build.classes.dir}" casesensitive="true"> |
| <include name="WEB-INF/lib/entity.jar"/> |
| </fileset> |
| |
| </jar> |
| <echo message="created war file ${war.file}"/> |
| <delete dir="${build.classes.dir}/WEB-INF" failonerror="false"/> |
| <echo message="my webclient war classes are:${webclient.war.classes}"/> |
| </target> |
| |
| |
| <!-- package entity classes and persistence.xml in ejb jar file --> |
| <target name="package-entity-ejb" depends="init-common"> |
| <mkdir dir="${assemble.dir}"/> |
| <mkdir dir="${build.classes.dir}/META-INF"/> |
| <copy file="${persistence.xml}" tofile="${build.classes.dir}/META-INF/persistence.xml" failonerror="false"/> |
| <jar jarfile="${assemble.dir}/${appname}-ejb.jar" basedir="${build.classes.dir}" |
| update="true" includes ="${ejbjar.classes}"> |
| <metainf dir="${build.classes.dir}/META-INF"> |
| <include name="**/*persistence.xml"/> |
| </metainf> |
| </jar> |
| <delete dir="${build.classes.dir}/META-INF" failonerror="false"/> |
| </target> |
| |