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.

 
                     Building OpenJPA
===============================================================================

These instructions describe how to build OpenJPA from source code using the
Apache Maven 2 build too. They are written for use from the console, and are 
known to work on Linux and Mac OSX. They are also reported to work from Windows.

The most up to date version of these instructions may be found on the OpenJPA 
website at http://openjpa.apache.org/building-openjpa.html

   1. Ensure that Java 1.5 or 1.6 is installed and on your path by running:
          java -version
      OpenJPA requires Java 1.5 or later, but some features are only available
      with Java 6.
   2. Install the build tool Apache Maven 2.0.9 or later, from:
          http://maven.apache.org/
      If it is installed correctly, typing mvn -v from the console will result
      in the text "Maven version: 2.0.9"
   3. Extract the source archive if you have not already done so. 
      The source will create a new directory named:
      openjpa-<version>-source. Where <version> is the openjpa 
      version, for example apache-openjpa-2.0.0-source.
   4. Change to the openjpa source directory, which has already been created in
      the previous step.
   5. Build OpenJPA by running: mvn package or better mvn install. 
      The first time you run the build, many dependencies are automatically 
      resolved and downloaded. It is common for dependency downloading to fail
      the first time, which will fail the build. If any of these dependency 
      downloads fail, just re-run the command. You may also add the following 
      to your ~/.m2/setting.xml file
      (see http://maven.apache.org/guides/mini/guide-mirror-settings.html)

       <settings>
           <mirrors>
               <mirror>
                   <id>repo.mergere.com</id>
                   <url>http://repo.mergere.com/maven2</url>
                   <mirrorOf>central</mirrorOf>
                   </mirror>
           </mirrors>
        </settings>

        If any tests fail, and you want to ignore the failures, instead run:
        mvn package -DskipTests

An example session as as follows:

$ cd /tmp/

$ java -version
java version "1.5.0_20"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02-315)
Java HotSpot(TM) Client VM (build 1.5.0_20-144, mixed mode, sharing)

$ mvn -v
Maven version: 2.0.10

$ svn --version
svn, version 1.5.5 (r34862)
   compiled Jan  5 2009, 12:30:39

$ svn co https://svn.apache.org/repos/asf/openjpa/trunk/
A  trunk/openjpa-lib
A  trunk/openjpa-lib/src
A  trunk/openjpa-lib/src/test
A  trunk/openjpa-lib/src/test/java
A  trunk/openjpa-lib/src/test/java/org
A  trunk/openjpa-lib/src/test/java/org/apache
A  trunk/openjpa-lib/src/test/java/org/apache/openjpa
A  trunk/openjpa-lib/src/test/java/org/apache/openjpa/lib
A  trunk/openjpa-lib/src/test/java/org/apache/openjpa/lib/test
A  trunk/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.
java

 ...

A  trunk/openjpa-persistence/pom.xml
Checked out revision 822485.

$ cd trunk/

$ mvn clean install -DfailIfNoTests=false -Dtest= 

[INFO] Scanning for projects...
[INFO] Reactor build order: 
[INFO]   OpenJPA Parent POM
[INFO]   OpenJPA Utilities Library
[INFO]   OpenJPA Kernel
[INFO]   OpenJPA JDBC
[INFO]   OpenJPA Persistence
[INFO]   OpenJPA Persistence JDBC
[INFO]   OpenJPA Persistence Locking Tests
[INFO]   OpenJPA XML Store
[INFO]   OpenJPA Slice
[INFO]   OpenJPA Aggregate Jar
[INFO]   OpenJPA Aggregate Jar with Dependencies
[INFO]   OpenJPA Project Docs and Assemblies
[INFO]   OpenJPA Examples
[INFO]   OpenJPA Integration Tests
[INFO]   OpenJPA Integration Tests - Examples
[INFO]   OpenJPA Integration Tests - JPA TCK
[INFO]   OpenJPA Integration Tests - Bean Validation
[INFO] ------------------------------------------------------------------------
[INFO] Building OpenJPA Parent POM
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------

 ...

[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] OpenJPA Parent POM .................................... SUCCESS [4.767s]
[INFO] OpenJPA Utilities Library ............................. SUCCESS [13.592s]
[INFO] OpenJPA Kernel ........................................ SUCCESS [14.810s]
[INFO] OpenJPA JDBC .......................................... SUCCESS [6.430s]
[INFO] OpenJPA Persistence ................................... SUCCESS [5.194s]
[INFO] OpenJPA Persistence JDBC .............................. SUCCESS [56.944s]
[INFO] OpenJPA Persistence Locking Tests ..................... SUCCESS [2.662s]
[INFO] OpenJPA XML Store ..................................... SUCCESS [1.423s]
[INFO] OpenJPA Slice ......................................... SUCCESS [2.742s]
[INFO] OpenJPA Aggregate Jar ................................. SUCCESS [10.928s]
[INFO] OpenJPA Aggregate Jar with Dependencies ............... SUCCESS [4.026s]
[INFO] OpenJPA Project Docs and Assemblies ................... SUCCESS [32.172s]
[INFO] OpenJPA Examples ...................................... SUCCESS [1.085s]
[INFO] OpenJPA Integration Tests ............................. SUCCESS [0.195s]
[INFO] OpenJPA Integration Tests - Examples .................. SUCCESS [0.128s]
[INFO] OpenJPA Integration Tests - JPA TCK ................... SUCCESS [0.136s]
[INFO] OpenJPA Integration Tests - Bean Validation ........... SUCCESS [2.956s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 42 seconds
[INFO] Finished at: Wed Oct 07 12:38:44 EDT 2009
[INFO] Final Memory: 96M/291M
[INFO] ------------------------------------------------------------------------


$ ls openjpa-project/target/site/downloads/

apache-openjpa-2.0.0-SNAPSHOT-binary.zip
apache-openjpa-2.0.0-SNAPSHOT-source.zip
 
