openbooks updates: put separate run/build.properties back, created a pom.xml that can be used to generate the jar but is not hooked into the build right now, updated build.xml to use standard /target for all output (still need think about how these *_.java files are getting updated in the source for every build...)

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@944450 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-05-14 20:29:27 +00:00
parent 64e8ea365a
commit 63e3f262fb
14 changed files with 187 additions and 35 deletions

View File

@ -0,0 +1,29 @@
# 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
#
# -------------------------------------------------------------------------------
# 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/${java2html.version}

View File

@ -25,13 +25,14 @@
<project name="OpenBooks" default="info">
<property file="openbook.properties" />
<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="deploy.dir" value="${basedir}/target/openbooks"/>
<property name="generated.html.dir" value="${basedir}/target/site"/>
<property name="jpa.properties" value="META-INF/persistence.xml#OpenBooks" />
@ -58,7 +59,7 @@
</fileset>
<target name="clean" description="Removes all *.class and generated metamodel source files">
<delete dir="${classes.dir}" failonerror="false"/>
<delete dir="${basedir}/target" failonerror="false"/>
<delete>
<fileset refid="canonical.metamodel"/>
</delete>
@ -75,12 +76,12 @@
<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.
Make sure openjpa.lib property value is correct in build.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.
Make sure java2html.lib property value is correct in build.properties file.
</fail>
</target>
@ -107,26 +108,35 @@
<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"/>
<delete file="${basedir}/target/openbooks.jar" failonerror="false"/>
<delete file="${basedir}/target/openbooks.zip" failonerror="false"/>
<jar destfile="openbooks.jar" basedir="${classes.dir}">
<jar destfile="${basedir}/target/openbooks.jar" basedir="${classes.dir}">
<exclude name="junit/**" />
</jar>
<jar destfile="openbooks.jar"
<jar destfile="${basedir}/target/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" />
<!-- ASF released jars must include License and Notice files -->
<jar destfile="${basedir}/target/openbooks.jar"
basedir="${basedir}"
update="true">
<include name="NOTICE.txt"/>
<include name="LICENSE.txt"/>
</jar>
<zip destfile="${basedir}/target/openbooks.zip" basedir="${basedir}">
<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">
<zip destfile="${basedir}/target/openbooks.zip" basedir="${basedir}/target" update="true">
<include name="openbooks.jar" />
</zip>
<zip destfile="${basedir}/target/openbooks.zip" basedir="${rsrc.dir}" update="true">
<include name="load.properties" />
<include name="demo.properties" />
<include name="META-INF/persistence.xml" />
@ -136,24 +146,26 @@
</target>
<target name="deploy" description="Transfers the distribution packge to a deploy directory">
<delete dir="${deploy.dir}" failonerror="false"/>
<mkdir dir="${deploy.dir}"/>
<unzip dest="${deploy.dir}" src="openbooks.zip" overwrite="true">
<unzip dest="${deploy.dir}" src="${basedir}/target/openbooks.zip" overwrite="true">
</unzip>
</target>
<target name="generate-html-source"
description="Generates HTML Source Code using Java2HTML utility">
<mkdir dir="${generated.src.dir}"/>
<delete dir="${generated.html.dir}" failonerror="false"/>
<mkdir dir="${generated.html.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="${generated.html.dir}"/>
<arg value="-style"/>
<arg value="Eclipse"/>
</java>
<replace dir="${generated.src.dir}" token="10pt" value="14pt">
<replace dir="${generated.html.dir}" token="10pt" value="14pt">
</replace>
</target>

View File

@ -0,0 +1,101 @@
<?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.
-->
<!--
Please keep the project tag on one line to avoid confusing
the release plugin.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-parent</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.openjpa.openjpa-examples</groupId>
<artifactId>openbooks</artifactId>
<packaging>jar</packaging>
<name>Apache OpenJPA :: Examples - OpenBooks</name>
<description>OpenJPA Examples - OpenBooks</description>
<properties>
<openjpa.Log>DefaultLevel=WARN</openjpa.Log>
<checkstyle.config.location>../../openjpa-project/checkstyle.xml</checkstyle.config.location>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-all</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.java2html</groupId>
<artifactId>java2html</artifactId>
<version>5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.12</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>build</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>build</id>
<configuration>
<tasks>
<echo>Running OpenBooks Build</echo>
<property name="openjpa.version" value="${project.version}" />
<property name="maven.repos" value="${settings.localRepository}" />
<ant antfile="${basedir}/build.xml">
<target name="package" />
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -24,7 +24,5 @@ maven.repos=${user.home}/.m2/repository
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

View File

@ -22,8 +22,8 @@
<!-- Ant script for running OpenBooks -->
<!-- -->
<!-- ====================================================================== -->
<project name="OpenBooks">
<property file="openbooks.properties"/>
<project name="OpenBooks" default="info">
<property file="run.properties"/>
<property name="jpa.provider" value="openjpa" />
<property name="load.properties" value="load.properties" />
<property name="demo.properties" value="demo.properties" />
@ -56,10 +56,18 @@
</target>
<target name="run" depends="check-env"
description="Runs OpenBooks Demo">
<java classname="openbook.client.Demo" fork="true">
<classpath refid="run.classpath" />
</java>
description="Runs OpenBooks Demo">
<java classname="openbook.client.Demo" fork="true">
<classpath refid="run.classpath" />
</java>
</target>
<target name="info" depends="check-env">
<echo>
Runs OpenBooks demo application.
See index.html for instructions.
</echo>
</target>
</project>

View File

@ -20,7 +20,8 @@ import java.util.jar.JarFile;
* Example
* $ java find.Finder org.eclipse.ui.plugin.AbstractUIPlugin c:\eclipse\plugins
* will print
* org.eclipse.ui.plugin.AbstractUIPlugin found in c:\eclipse\plugins\org.eclipse.ui.workbench_3.4.1.M20080827-0800a.jar
* org.eclipse.ui.plugin.AbstractUIPlugin found in
* c:\eclipse\plugins\org.eclipse.ui.workbench_3.4.1.M20080827-0800a.jar
*
* @author Pinaki Poddar
*
@ -109,3 +110,4 @@ public class Finder {
System.err.println(s);
}
}

View File

@ -131,4 +131,5 @@ public class ImageBorder extends AbstractBorder {
gfx.dispose();
return buff;
}
}
}

View File

@ -456,4 +456,5 @@ public final class BuyBookPage extends JPanel {
}.execute();
}
}
}
}

View File

@ -10,7 +10,7 @@ import javax.persistence.metamodel.SingularAttribute;
@javax.persistence.metamodel.StaticMetamodel
(value=openbook.domain.Author.class)
@javax.annotation.Generated
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Thu May 13 20:18:23 CDT 2010")
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Fri May 14 16:05:41 EDT 2010")
public class Author_ {
public static volatile SetAttribute<Author,Book> books;
public static volatile SingularAttribute<Author,Long> id;

View File

@ -10,7 +10,7 @@ import javax.persistence.metamodel.SingularAttribute;
@javax.persistence.metamodel.StaticMetamodel
(value=openbook.domain.Book.class)
@javax.annotation.Generated
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Thu May 13 20:18:23 CDT 2010")
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Fri May 14 16:05:41 EDT 2010")
public class Book_ {
public static volatile SingularAttribute<Book,String> ISBN;
public static volatile ListAttribute<Book,Author> authors;

View File

@ -9,7 +9,7 @@ import javax.persistence.metamodel.SingularAttribute;
@javax.persistence.metamodel.StaticMetamodel
(value=openbook.domain.Customer.class)
@javax.annotation.Generated
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Thu May 13 20:18:23 CDT 2010")
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Fri May 14 16:05:41 EDT 2010")
public class Customer_ {
public static volatile SingularAttribute<Customer,String> email;
public static volatile SingularAttribute<Customer,Long> id;

View File

@ -9,7 +9,7 @@ import javax.persistence.metamodel.SingularAttribute;
@javax.persistence.metamodel.StaticMetamodel
(value=openbook.domain.Inventory.class)
@javax.annotation.Generated
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Thu May 13 20:18:23 CDT 2010")
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Fri May 14 16:05:41 EDT 2010")
public class Inventory_ {
public static volatile SingularAttribute<Inventory,Book> book;
public static volatile SingularAttribute<Inventory,Integer> sold;

View File

@ -9,7 +9,7 @@ import javax.persistence.metamodel.SingularAttribute;
@javax.persistence.metamodel.StaticMetamodel
(value=openbook.domain.LineItem.class)
@javax.annotation.Generated
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Thu May 13 20:18:23 CDT 2010")
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Fri May 14 16:05:41 EDT 2010")
public class LineItem_ {
public static volatile SingularAttribute<LineItem,Book> book;
public static volatile SingularAttribute<LineItem,Integer> index;

View File

@ -12,7 +12,7 @@ import openbook.domain.PurchaseOrder.Status;
@javax.persistence.metamodel.StaticMetamodel
(value=openbook.domain.PurchaseOrder.class)
@javax.annotation.Generated
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Thu May 13 20:18:23 CDT 2010")
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Fri May 14 16:05:41 EDT 2010")
public class PurchaseOrder_ {
public static volatile SingularAttribute<PurchaseOrder,Customer> customer;
public static volatile SingularAttribute<PurchaseOrder,Date> deliveredOn;