You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by dw...@apache.org on 2010/07/29 21:34:57 UTC
svn commit: r980549 - in /openjpa/trunk/openjpa-examples/openbooks: ./
src/main/java/openbook/tools/ src/main/java/openbook/tools/converter/
src/main/resources/META-INF/
Author: dwoods
Date: Thu Jul 29 19:34:56 2010
New Revision: 980549
URL: http://svn.apache.org/viewvc?rev=980549&view=rev
Log:
OPENJPA-1751 Allow OpenBooks to be built and packaged via Maven (reuses ANT scripts.)
Added:
openjpa/trunk/openjpa-examples/openbooks/assembly.xml (with props)
Modified:
openjpa/trunk/openjpa-examples/openbooks/build.properties
openjpa/trunk/openjpa-examples/openbooks/build.xml
openjpa/trunk/openjpa-examples/openbooks/pom.xml
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java
openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java
openjpa/trunk/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml
Added: openjpa/trunk/openjpa-examples/openbooks/assembly.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/assembly.xml?rev=980549&view=auto
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/assembly.xml (added)
+++ openjpa/trunk/openjpa-examples/openbooks/assembly.xml Thu Jul 29 19:34:56 2010
@@ -0,0 +1,78 @@
+<?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.
+-->
+<assembly>
+ <id>binary</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>load.properties</include>
+ <include>demo.properties</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources/META-INF</directory>
+ <outputDirectory>/META-INF</outputDirectory>
+ <includes>
+ <include>persistence.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources/slides</directory>
+ <outputDirectory>/slides</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>run.properties</include>
+ <include>run.xml</include>
+ <include>index.html</include>
+ <include>NOTICE.txt</include>
+ <include>LICENSE.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/generated-html</directory>
+ <outputDirectory>/source</outputDirectory>
+ <includes>
+ <include>**/*.css</include>
+ <include>**/*.html</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <unpack>false</unpack>
+ <scope>runtime</scope>
+ <includes>
+ <include>org.apache.openjpa.openjpa-examples:openbooks</include>
+ <include>org.apache.openjpa:openjpa-all</include>
+ <include>org.apache.derby:derby</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
Propchange: openjpa/trunk/openjpa-examples/openbooks/assembly.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/trunk/openjpa-examples/openbooks/build.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/build.properties?rev=980549&r1=980548&r2=980549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/build.properties (original)
+++ openjpa/trunk/openjpa-examples/openbooks/build.properties Thu Jul 29 19:34:56 2010
@@ -33,4 +33,7 @@ openjpa.lib=${maven.repos}/org/apache/op
# Requires ANTLR to generate syntax colored Java source code
# Not essential, but otherwise you can configure demo.properties to browse
# FishEye source code with syntax coloring
-antlr.lib=c:/antlr/antlr-3.2.jar
+antlr.version=3.2
+antlr.lib=${maven.repos}/org/antlr/antlr/${antlr.version}
+antlr-runtime.lib=${maven.repos}/org/antlr/antlr-runtime/${antlr.version}
+
Modified: openjpa/trunk/openjpa-examples/openbooks/build.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/build.xml?rev=980549&r1=980548&r2=980549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/build.xml (original)
+++ openjpa/trunk/openjpa-examples/openbooks/build.xml Thu Jul 29 19:34:56 2010
@@ -76,9 +76,13 @@
<path id="code.generation.classpath"
description="">
- <pathelement location="${ant.home}/ant.jar" />
- <pathelement location="${antlr.lib}" />
<pathelement location="${classes.dir}" />
+ <fileset dir="${antlr.lib}">
+ <include name="*.jar" />
+ </fileset>
+ <fileset dir="${antlr-runtime.lib}">
+ <include name="*.jar" />
+ </fileset>
</path>
@@ -128,7 +132,16 @@
</condition>
<mkdir dir="${deploy.dir}"/>
- <available file="${antlr.lib}" property="antlr.exists" />
+ <available file="${antlr.lib}" property="antlr.exists"/>
+<!--
+ <condition property="antlr.exists">
+ <and>
+ <isset property="antlr.lib.exists" />
+ <available classname="org.antlr.Tool" />
+ </and>
+ </condition>
+ <fail unless="antlr.exists" message="ANTLR is missing from classpath"/>
+-->
</target>
<target name="generate-canonical-model" depends="check-env"
Modified: openjpa/trunk/openjpa-examples/openbooks/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/pom.xml?rev=980549&r1=980548&r2=980549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/pom.xml (original)
+++ openjpa/trunk/openjpa-examples/openbooks/pom.xml Thu Jul 29 19:34:56 2010
@@ -50,6 +50,22 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>3.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.8.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>de.java2html</groupId>
<artifactId>java2html</artifactId>
<version>5.0</version>
@@ -63,6 +79,34 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>checkstyle</goal>
+ </goals>
+ <configuration>
+ <excludes>**/*_.java,**/Java*.java</excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <!-- Don't publish these artifacts to central -->
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
<id>build</id>
@@ -70,6 +114,11 @@
<activeByDefault>true</activeByDefault>
</activation>
<build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -84,7 +133,7 @@
<property name="openjpa.version" value="${project.version}" />
<property name="maven.repos" value="${settings.localRepository}" />
<ant antfile="${basedir}/build.xml">
- <target name="genmodel" />
+ <target name="generate-canonical-model" />
</ant>
</tasks>
</configuration>
@@ -110,15 +159,15 @@
</goals>
</execution>
<execution>
- <id>generate-html-source</id>
+ <id>generate-source</id>
<phase>prepare-package</phase>
<configuration>
<tasks>
- <echo>Running OpenBooks Generate HTML Source</echo>
+ <echo>Running OpenBooks Generate Source</echo>
<property name="openjpa.version" value="${project.version}" />
<property name="maven.repos" value="${settings.localRepository}" />
<ant antfile="${basedir}/build.xml">
- <target name="generate-html-source" />
+ <target name="generate-source" />
</ant>
<copy todir="${basedir}/target">
<fileset dir="${basedir}"
@@ -136,6 +185,24 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bin</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</profile>
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java?rev=980549&r1=980548&r2=980549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/CommandProcessor.java Thu Jul 29 19:34:56 2010
@@ -303,7 +303,9 @@ public class CommandProcessor {
*/
public Option setDefault(String v) {
if (!requiresInput)
- throw new IllegalStateException(this + " does not require a value. Can not set default value [" + v + "]");
+ throw new IllegalStateException(this +
+ " does not require a value. Can not set default value [" +
+ v + "]");
defValue = v;
return this;
}
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java?rev=980549&r1=980548&r2=980549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/java/openbook/tools/converter/SourceRenderer.java Thu Jul 29 19:34:56 2010
@@ -51,7 +51,8 @@ public abstract class SourceRenderer {
* <br>
* <pre> $ java SourceRenderer [options] files </pre>
* For example,
- * <pre> $ java SourceRenderer -stylesheet mystyle.css -sourcepath test -d generated/html acme/foo/SomeClass.java</pre>
+ * <pre> $ java SourceRenderer -stylesheet mystyle.css -sourcepath test
+ * -d generated/html acme/foo/SomeClass.java</pre>
* <p>
*
* Recognized options are<br>
Modified: openjpa/trunk/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml?rev=980549&r1=980548&r2=980549&view=diff
==============================================================================
--- openjpa/trunk/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml (original)
+++ openjpa/trunk/openjpa-examples/openbooks/src/main/resources/META-INF/persistence.xml Thu Jul 29 19:34:56 2010
@@ -31,11 +31,17 @@
<class>openbook.domain.Author</class>
<properties>
+ <!-- Use these for MySQL
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/OpenBooks"/>
<property name="javax.persistence.jdbc.user" value="scott"/>
<property name="javax.persistence.jdbc.password" value="tiger"/>
-
+ -->
+ <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:OpenBooks;create=true"/>
+ <property name="javax.persistence.jdbc.user" value=""/>
+ <property name="javax.persistence.jdbc.password" value=""/>
+
<property name="openjpa.DataCache" value="true"/>
<property name="openjpa.RemoteCommitProvider" value="sjvm"/>