combine build.properties and run.properties into one file, add missing ASL2 header to index.html, use .m2 for java2html and mysql dependencies.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@944341 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-05-14 16:53:06 +00:00
parent 646d9f37d1
commit cc14c901d1
5 changed files with 188 additions and 191 deletions

View File

@ -1,31 +0,0 @@
# 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.
#
#
# -------------------------------------------------------------------------------
# Environment variables for provider specific library to build OpenBooks
#
# Edit the following properties to locate resources in your environment
# -------------------------------------------------------------------------------
#
# Directory location of OpenJPA library. All *.jar files in the library are
# included in the compiler classpath
maven.repos=${user.home}/.m2/repository
openjpa.version=2.1.0-SNAPSHOT
openjpa.lib=${maven.repos}/org/apache/openjpa/openjpa-all/${openjpa.version}
#
#
# Directory where the pre-packaged demo distribution will be created.
deploy.dir=C:/temp/OpenBooks

View File

@ -1,154 +1,160 @@
<?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.
-->
<!-- ====================================================================== -->
<!-- -->
<!-- Ant build script for OpenBooks -->
<!-- -->
<!-- ====================================================================== -->
<project name="OpenBooks" default="info">
<property file="build.properties" />
<property name="jpa.provider" value="openjpa" />
<property name="src.dir" value="${basedir}/src/main/java"/>
<property name="rsrc.dir" value="${basedir}/src/main/resources"/>
<property name="classes.dir" value="${basedir}/target/classes"/>
<property name="generated.src.dir" value="${rsrc.dir}/source"/>
<property name="jpa.properties" value="META-INF/persistence.xml#OpenBooks" />
<path id="compile.classpath" description="compilation requires OpenJPA specific library">
<pathelement location="${src.dir}" />
<pathelement location="${classes.dir}" />
<pathelement location="${rsrc.dir}" />
<fileset dir="${openjpa.lib}">
<include name="*.jar" />
</fileset>
</path>
<path id="java2html.classpath">
<pathelement location="${rsrc.dir}" />
<pathelement location="lib/java2html.jar" />
</path>
<fileset id="canonical.metamodel" dir="${src.dir}"
description="Set of *.java files generated for static, cannonical domain model">
<include name="**/*_.java"/>
</fileset>
<target name="clean" description="Removes all *.class and generated metamodel source files">
<delete dir="${classes.dir}" failonerror="false"/>
<delete>
<fileset refid="canonical.metamodel"/>
</delete>
</target>
<target name="info" depends="check-env">
<echo>
Builds OpenBooks demo application.
OpenJPA Library: ${openjpa.lib}
</echo>
</target>
<target name="check-env" description="Checks if OpenJPA library exists">
<available file="${openjpa.lib}" property="openjpa.exists"/>
<fail unless="openjpa.exists">*** Error:
The directory for OpenJPA libraries can not be located at ${openjpa.lib}.
Make sure openjpa.lib property value is correct in build.properties file.
</fail>
</target>
<target name="compile" depends="check-env,clean"
description="Compilation will also generate canonical meta-model classes.">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="compile.classpath" />
<include name="openbook/domain/*.java"/>
<compilerarg value="-Aopenjpa.metamodel=true" />
<compilerarg value="-Aopenjpa.log=TRACE" />
<compilerarg value="-s"/>
<compilerarg value="${src.dir}" />
</javac>
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="compile.classpath" />
</javac>
<java classname="org.apache.openjpa.enhance.PCEnhancer" fork="true">
<arg value="-properties" />
<arg value="${jpa.properties}" />
<classpath refid="compile.classpath" />
</java>
</target>
<target name="package" depends="clean,compile,generate-html-source"
description="Generates HTML version of source code and creates distribution layout">
<delete file="openbooks.jar" failonerror="false"/>
<delete file="openbooks.zip" failonerror="false"/>
<jar destfile="openbooks.jar" basedir="${classes.dir}">
<exclude name="junit/**" />
</jar>
<jar destfile="openbooks.jar"
basedir="${rsrc.dir}"
update="true">
<include name="images/*" />
</jar>
<zip destfile="openbooks.zip" basedir="${basedir}">
<include name="openbooks.jar" />
<include name="run.properties" />
<include name="run.xml" />
<include name="index.html" />
<include name="NOTICE.txt"/>
<include name="LICENSE.txt"/>
</zip>
<zip destfile="openbooks.zip" basedir="${rsrc.dir}" update="true">
<include name="load.properties" />
<include name="demo.properties" />
<include name="META-INF/persistence.xml" />
<include name="slides/**" />
<include name="source/**" />
</zip>
</target>
<target name="deploy" description="Transfers the distribution packge to a deploy directory">
<mkdir dir="${deploy.dir}"/>
<unzip dest="${deploy.dir}" src="openbooks.zip" overwrite="true">
</unzip>
</target>
<target name="generate-html-source"
description="Generates HTML Source Code using Java2HTML utility">
<mkdir dir="${generated.src.dir}"/>
<java classname="de.java2html.Java2Html" fork="true">
<classpath refid="java2html.classpath"/>
<arg value="-srcdir"/>
<arg value="${src.dir}"/>
<arg value="-targetdir"/>
<arg value="${generated.src.dir}"/>
<arg value="-style"/>
<arg value="Eclipse"/>
</java>
<replace dir="${generated.src.dir}" token="10pt" value="14pt">
<?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.
-->
<!-- ====================================================================== -->
<!-- -->
<!-- Ant build script for OpenBooks -->
<!-- -->
<!-- ====================================================================== -->
<project name="OpenBooks" default="info">
<property file="openbook.properties" />
<property name="jpa.provider" value="openjpa" />
<property name="src.dir" value="${basedir}/src/main/java"/>
<property name="rsrc.dir" value="${basedir}/src/main/resources"/>
<property name="classes.dir" value="${basedir}/target/classes"/>
<property name="generated.src.dir" value="${rsrc.dir}/source"/>
<property name="jpa.properties" value="META-INF/persistence.xml#OpenBooks" />
<path id="compile.classpath" description="compilation requires OpenJPA specific library">
<pathelement location="${src.dir}" />
<pathelement location="${classes.dir}" />
<pathelement location="${rsrc.dir}" />
<fileset dir="${openjpa.lib}">
<include name="*.jar" />
</fileset>
</path>
<path id="java2html.classpath">
<pathelement location="${rsrc.dir}" />
<fileset dir="${java2html.lib}">
<include name="*.jar" />
</fileset>
</path>
<fileset id="canonical.metamodel" dir="${src.dir}"
description="Set of *.java files generated for static, cannonical domain model">
<include name="**/*_.java"/>
</fileset>
<target name="clean" description="Removes all *.class and generated metamodel source files">
<delete dir="${classes.dir}" failonerror="false"/>
<delete>
<fileset refid="canonical.metamodel"/>
</delete>
</target>
<target name="info" depends="check-env">
<echo>
Builds OpenBooks demo application.
OpenJPA Library: ${openjpa.lib}
</echo>
</target>
<target name="check-env" description="Checks if required libraries exist">
<available file="${openjpa.lib}" property="openjpa.exists"/>
<fail unless="openjpa.exists">*** Error:
The directory for OpenJPA libraries can not be located at ${openjpa.lib}.
Make sure openjpa.lib property value is correct in openbooks.properties file.
</fail>
<available file="${java2html.lib}" property="java2html.exists"/>
<fail unless="java2html.exists">*** Error:
The directory for Java2HTML libraries can not be located at ${java2html.lib}.
Make sure java2html.lib property value is correct in openbooks.properties file.
</fail>
</target>
<target name="compile" depends="check-env,clean"
description="Compilation will also generate canonical meta-model classes.">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="compile.classpath" />
<include name="openbook/domain/*.java"/>
<compilerarg value="-Aopenjpa.metamodel=true" />
<compilerarg value="-Aopenjpa.log=TRACE" />
<compilerarg value="-s"/>
<compilerarg value="${src.dir}" />
</javac>
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true">
<classpath refid="compile.classpath" />
</javac>
<java classname="org.apache.openjpa.enhance.PCEnhancer" fork="true">
<arg value="-properties" />
<arg value="${jpa.properties}" />
<classpath refid="compile.classpath" />
</java>
</target>
<target name="package" depends="clean,compile,generate-html-source"
description="Generates HTML version of source code and creates distribution layout">
<delete file="openbooks.jar" failonerror="false"/>
<delete file="openbooks.zip" failonerror="false"/>
<jar destfile="openbooks.jar" basedir="${classes.dir}">
<exclude name="junit/**" />
</jar>
<jar destfile="openbooks.jar"
basedir="${rsrc.dir}"
update="true">
<include name="images/*" />
</jar>
<zip destfile="openbooks.zip" basedir="${basedir}">
<include name="openbooks.jar" />
<include name="openbooks.properties" />
<include name="run.xml" />
<include name="index.html" />
<include name="NOTICE.txt"/>
<include name="LICENSE.txt"/>
</zip>
<zip destfile="openbooks.zip" basedir="${rsrc.dir}" update="true">
<include name="load.properties" />
<include name="demo.properties" />
<include name="META-INF/persistence.xml" />
<include name="slides/**" />
<include name="source/**" />
</zip>
</target>
<target name="deploy" description="Transfers the distribution packge to a deploy directory">
<mkdir dir="${deploy.dir}"/>
<unzip dest="${deploy.dir}" src="openbooks.zip" overwrite="true">
</unzip>
</target>
<target name="generate-html-source"
description="Generates HTML Source Code using Java2HTML utility">
<mkdir dir="${generated.src.dir}"/>
<java classname="de.java2html.Java2Html" fork="true">
<classpath refid="java2html.classpath"/>
<arg value="-srcdir"/>
<arg value="${src.dir}"/>
<arg value="-targetdir"/>
<arg value="${generated.src.dir}"/>
<arg value="-style"/>
<arg value="Eclipse"/>
</java>
<replace dir="${generated.src.dir}" token="10pt" value="14pt">
</replace>
</target>
</project>
</target>
</project>

View File

@ -1,3 +1,23 @@
<!--
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.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h1>OpenBooks: A sample JPA 2.0 Application</h1>
@ -65,4 +85,4 @@
<code>$ ant -f run.xml run</code>
<hr>
</body>
</html>
</html>

View File

@ -18,11 +18,13 @@
# Environment variables for provider specific library to run OpenBooks
#
# -------------------------------------------------------------------------------
# Directory location of OpenJPA library. All *.jar files in the library are
# included in the compiler classpath
# Directory location of maven repository
maven.repos=${user.home}/.m2/repository
# OpenJPA runtime artifact
openjpa.version=2.1.0-SNAPSHOT
openjpa.lib=${maven.repos}/org/apache/openjpa/openjpa-all/${openjpa.version}
# Other depends
java2html.version=5.0
java2html.lib=${maven.repos}/de/java2html/${java2html.version}
jdbc.driver=${maven.repos}/mysql/mysql-connector-java/5.1.12/mysql-connector-java-5.1.12.jar
# JDBC Library.
jdbc.driver=c:/mysql/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar

View File

@ -23,7 +23,7 @@
<!-- -->
<!-- ====================================================================== -->
<project name="OpenBooks">
<property file="run.properties"/>
<property file="openbooks.properties"/>
<property name="jpa.provider" value="openjpa" />
<property name="load.properties" value="load.properties" />
<property name="demo.properties" value="demo.properties" />
@ -62,4 +62,4 @@
</java>
</target>
</project>