2010-06-04 12:55:52 -04:00
|
|
|
Building Apache OpenJPA
|
|
|
|
Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
--------------------------------------------------------------------------------
|
2007-04-03 00:19:30 -04:00
|
|
|
|
2015-05-05 05:45:45 -04:00
|
|
|
These instructions describe how to build OpenJPA from source code using the
|
2018-10-02 08:32:32 -04:00
|
|
|
Apache Maven 2 build tool. They are written for use from the console, and are
|
2010-10-15 12:57:55 -04:00
|
|
|
known to work on Windows, Linux and Mac OSX.
|
2007-04-03 00:19:30 -04:00
|
|
|
|
2018-10-02 08:32:32 -04:00
|
|
|
The most up to date version of these instructions may be found on the OpenJPA
|
2011-01-30 14:27:21 -05:00
|
|
|
website at http://openjpa.apache.org/building.html
|
2007-04-03 00:19:30 -04:00
|
|
|
|
2010-02-24 11:15:48 -05:00
|
|
|
1. Ensure that Java SE 6 is installed and on your path by running:
|
2009-10-07 14:47:55 -04:00
|
|
|
java -version
|
2010-10-15 12:57:55 -04:00
|
|
|
OpenJPA requires Java 1.6 or later to build and for runtime.
|
2010-08-10 08:54:23 -04:00
|
|
|
2. Install the build tool Apache Maven 2.2.1 or later, from:
|
2009-10-07 14:47:55 -04:00
|
|
|
http://maven.apache.org/
|
2007-04-03 00:19:30 -04:00
|
|
|
If it is installed correctly, typing mvn -v from the console will result
|
2011-01-30 14:27:21 -05:00
|
|
|
in the text like "Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)"
|
2018-10-02 08:32:32 -04:00
|
|
|
3. Extract the source archive if you have not already done so.
|
2007-04-03 00:19:30 -04:00
|
|
|
The source will create a new directory named:
|
2018-10-02 08:32:32 -04:00
|
|
|
openjpa-<version>-source. Where <version> is the OpenJPA
|
2011-01-30 14:27:21 -05:00
|
|
|
version, for example apache-openjpa-2.2.0-source.
|
|
|
|
4. Change to the OpenJPA source directory, which has already been created in
|
2007-04-03 00:19:30 -04:00
|
|
|
the previous step.
|
2018-10-02 08:32:32 -04:00
|
|
|
5. Build OpenJPA by running: mvn package or better mvn install.
|
|
|
|
The first time you run the build, many dependencies are automatically
|
2007-04-03 00:19:30 -04:00
|
|
|
resolved and downloaded. It is common for dependency downloading to fail
|
2018-10-02 08:32:32 -04:00
|
|
|
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
|
2007-04-03 00:19:30 -04:00
|
|
|
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:
|
2008-06-11 20:01:46 -04:00
|
|
|
mvn package -DskipTests
|
2007-04-03 00:19:30 -04:00
|
|
|
|
2011-01-30 14:27:21 -05:00
|
|
|
An example session is as follows:
|
2007-04-03 00:19:30 -04:00
|
|
|
|
|
|
|
$ cd /tmp/
|
|
|
|
|
|
|
|
$ java -version
|
2010-02-24 11:15:48 -05:00
|
|
|
java version "1.6.0_17"
|
|
|
|
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
|
|
|
|
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
|
2007-04-03 00:19:30 -04:00
|
|
|
|
|
|
|
$ mvn -v
|
2011-01-30 14:27:21 -05:00
|
|
|
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
|
|
|
|
|
|
|
|
...
|
2007-04-03 00:19:30 -04:00
|
|
|
|
|
|
|
$ svn --version
|
2009-10-07 14:47:55 -04:00
|
|
|
svn, version 1.5.5 (r34862)
|
|
|
|
compiled Jan 5 2009, 12:30:39
|
2007-04-03 00:19:30 -04:00
|
|
|
|
2007-08-14 18:39:55 -04:00
|
|
|
$ svn co https://svn.apache.org/repos/asf/openjpa/trunk/
|
2007-04-03 00:19:30 -04:00
|
|
|
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
|
2010-08-10 08:54:23 -04:00
|
|
|
A trunk/openjpa-lib/src/test/java/org/apache/openjpa/lib/test/AbstractTestCase.java
|
2007-04-03 00:19:30 -04:00
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
A trunk/openjpa-persistence/pom.xml
|
2011-01-30 14:27:21 -05:00
|
|
|
Checked out revision 1065345.
|
2007-04-03 00:19:30 -04:00
|
|
|
|
|
|
|
$ cd trunk/
|
|
|
|
|
2018-10-02 08:32:32 -04:00
|
|
|
$ mvn clean install -DskipTests -DfailIfNoTests=false
|
2007-04-03 00:19:30 -04:00
|
|
|
|
|
|
|
[INFO] Scanning for projects...
|
2018-10-02 08:32:32 -04:00
|
|
|
[INFO] Reactor build order:
|
2009-10-07 14:47:55 -04:00
|
|
|
[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
|
2012-02-09 11:51:24 -05:00
|
|
|
[INFO] OpenJPA tools
|
|
|
|
[INFO] OpenJPA Maven Plugin
|
2009-10-07 14:47:55 -04:00
|
|
|
[INFO] OpenJPA XML Store
|
|
|
|
[INFO] OpenJPA Slice
|
2011-01-30 14:27:21 -05:00
|
|
|
[INFO] OpenJPA JEST
|
2009-10-07 14:47:55 -04:00
|
|
|
[INFO] OpenJPA Aggregate Jar
|
|
|
|
[INFO] OpenJPA Aggregate Jar with Dependencies
|
|
|
|
[INFO] OpenJPA Project Docs and Assemblies
|
|
|
|
[INFO] OpenJPA Examples
|
2011-01-30 14:27:21 -05:00
|
|
|
[INFO] OpenJPA Examples - Simple
|
|
|
|
[INFO] OpenJPA Examples - image-gallery
|
|
|
|
[INFO] OpenJPA Examples - OpenBooks
|
2009-10-07 14:47:55 -04:00
|
|
|
[INFO] OpenJPA Integration Tests
|
2011-01-30 14:27:21 -05:00
|
|
|
[INFO] OpenJPA Integration Tests - Daytrader
|
2009-10-07 14:47:55 -04:00
|
|
|
[INFO] OpenJPA Integration Tests - Examples
|
2011-01-30 14:27:21 -05:00
|
|
|
[INFO] OpenJPA Integration Tests - SLF4JLogFactory
|
2009-10-07 14:47:55 -04:00
|
|
|
[INFO] OpenJPA Integration Tests - JPA TCK
|
|
|
|
[INFO] OpenJPA Integration Tests - Bean Validation
|
2011-01-30 14:27:21 -05:00
|
|
|
[INFO] OpenJPA Integration Tests - JMX Platform MBeans
|
2009-10-07 14:47:55 -04:00
|
|
|
[INFO] ------------------------------------------------------------------------
|
|
|
|
[INFO] Building OpenJPA Parent POM
|
|
|
|
[INFO] task-segment: [clean, install]
|
|
|
|
[INFO] ------------------------------------------------------------------------
|
2007-04-03 00:19:30 -04:00
|
|
|
|
|
|
|
...
|
|
|
|
|
2018-10-02 08:32:32 -04:00
|
|
|
[INFO]
|
2007-04-03 00:19:30 -04:00
|
|
|
[INFO] ------------------------------------------------------------------------
|
|
|
|
[INFO] Reactor Summary:
|
|
|
|
[INFO] ------------------------------------------------------------------------
|
2012-02-09 11:51:24 -05:00
|
|
|
[INFO] OpenJPA Parent POM .................................... SUCCESS [2:11.649s]
|
|
|
|
[INFO] OpenJPA Utilities Library ............................. SUCCESS [31.576s]
|
|
|
|
[INFO] OpenJPA Kernel ........................................ SUCCESS [39.863s]
|
|
|
|
[INFO] OpenJPA JDBC .......................................... SUCCESS [27.326s]
|
|
|
|
[INFO] OpenJPA Persistence ................................... SUCCESS [23.530s]
|
|
|
|
[INFO] OpenJPA Persistence JDBC .............................. SUCCESS [1:14.696s]
|
|
|
|
[INFO] OpenJPA Persistence Locking Tests ..................... SUCCESS [30.881s]
|
|
|
|
[INFO] OpenJPA tools ......................................... SUCCESS [0.968s]
|
|
|
|
[INFO] OpenJPA Maven Plugin .................................. SUCCESS [2:45.320s]
|
|
|
|
[INFO] OpenJPA XML Store ..................................... SUCCESS [25.335s]
|
|
|
|
[INFO] OpenJPA Slice ......................................... SUCCESS [10.456s]
|
|
|
|
[INFO] OpenJPA JEST .......................................... SUCCESS [8.861s]
|
|
|
|
[INFO] OpenJPA Aggregate Jar ................................. SUCCESS [50.297s]
|
|
|
|
[INFO] OpenJPA Aggregate Jar with Dependencies ............... SUCCESS [13.871s]
|
|
|
|
[INFO] OpenJPA Project Docs and Assemblies ................... SUCCESS [1:12.215s]
|
|
|
|
[INFO] OpenJPA Examples ...................................... SUCCESS [1.241s]
|
|
|
|
[INFO] OpenJPA Examples - Simple ............................. SUCCESS [5.165s]
|
|
|
|
[INFO] OpenJPA Examples - image-gallery ...................... SUCCESS [6.933s]
|
|
|
|
[INFO] OpenJPA Examples - OpenBooks .......................... SUCCESS [26.761s]
|
|
|
|
[INFO] OpenJPA Integration Tests ............................. SUCCESS [0.957s]
|
|
|
|
[INFO] OpenJPA Integration Tests - Daytrader ................. SUCCESS [21.631s]
|
|
|
|
[INFO] OpenJPA Integration Tests - Examples .................. SUCCESS [0.143s]
|
|
|
|
[INFO] OpenJPA Integration Tests - SLF4JLogFactory ........... SUCCESS [6.690s]
|
|
|
|
[INFO] OpenJPA Integration Tests - JPA TCK ................... SUCCESS [0.321s]
|
|
|
|
[INFO] OpenJPA Integration Tests - Bean Validation ........... SUCCESS [10.694s]
|
|
|
|
[INFO] OpenJPA Integration Tests - JMX Platform MBeans ....... SUCCESS [19.434s]
|
2007-04-03 00:19:30 -04:00
|
|
|
[INFO] ------------------------------------------------------------------------
|
|
|
|
[INFO] ------------------------------------------------------------------------
|
|
|
|
[INFO] BUILD SUCCESSFUL
|
|
|
|
[INFO] ------------------------------------------------------------------------
|
2012-02-09 11:51:24 -05:00
|
|
|
[INFO] Total time: 13 minutes 33 seconds
|
|
|
|
[INFO] Finished at: Thu Feb 09 10:25:05 CST 2012
|
|
|
|
[INFO] Final Memory: 118M/232M
|
2007-04-03 00:19:30 -04:00
|
|
|
[INFO] ------------------------------------------------------------------------
|
|
|
|
|
2009-10-07 14:47:55 -04:00
|
|
|
$ ls openjpa-project/target/site/downloads/
|
2007-04-03 00:19:30 -04:00
|
|
|
|
2011-01-30 14:27:21 -05:00
|
|
|
apache-openjpa-2.2.0-SNAPSHOT-binary.zip
|
|
|
|
apache-openjpa-2.2.0-SNAPSHOT-source.zip
|
2015-01-09 12:20:59 -05:00
|
|
|
|
|
|
|
|
2015-05-05 05:45:45 -04:00
|
|
|
|
|
|
|
Advanced Build Options
|
|
|
|
======================
|
|
|
|
|
|
|
|
|
2015-01-09 12:20:59 -05:00
|
|
|
To speed up the local build time you might want to exclude the tests which
|
|
|
|
check locking timeouts as they take a really long time (mostly waiting for
|
|
|
|
timeout expiration).
|
|
|
|
|
|
|
|
This can be achieved by building the project with
|
2015-05-05 05:45:45 -04:00
|
|
|
$ mvn clean install -Dsurefire.excludes.locking=**/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Building and deploying the Site
|
|
|
|
===============================
|
|
|
|
|
|
|
|
$ mvn site site:deploy -Pjavadoc-profile,docbook-profile
|
2015-06-02 14:04:26 -04:00
|
|
|
|
2016-03-16 03:28:17 -04:00
|
|
|
To generate the docbook documentation you need to cd into the openjpa-project directory and run
|
|
|
|
|
|
|
|
$ cd ./openjpa-project
|
|
|
|
$ mvn clean install -Papache-release,docbook-profile
|
|
|
|
|
|
|
|
The generated PDF is available under ./target/docbook/manual.pdf
|
|
|
|
|
2015-06-02 14:04:26 -04:00
|
|
|
|
|
|
|
Running unit tests in the Debugger
|
|
|
|
==================================
|
2019-01-28 07:00:05 -05:00
|
|
|
|
2019-01-20 08:49:52 -05:00
|
|
|
By default all tests run against a derby database.
|
|
|
|
To run the tests in the debugger simply add the following JVM properties
|
|
|
|
|
2019-02-14 04:03:35 -05:00
|
|
|
-ea -Dopenjpa.ConnectionURL=jdbc:derby:target/database/openjpa-derby-database;create=true -Dopenjpa.ConnectionDriverName=org.apache.derby.jdbc.EmbeddedDriver
|
2015-06-02 14:04:26 -04:00
|
|
|
|
2018-11-03 17:54:12 -04:00
|
|
|
For running against a MySQL Docker installation:
|
2019-01-20 08:49:52 -05:00
|
|
|
-ea -Dopenjpa.ConnectionDriverName=com.mysql.jdbc.Driver -Dopenjpa.ConnectionURL=jdbc:mysql://localhost:3306/openjpatst -Dopenjpa.ConnectionUserName=openjpatst -Dopenjpa.ConnectionPassword=openjpatst
|
2018-11-03 17:54:12 -04:00
|
|
|
|
|
|
|
Running against a PostgreSQL Docker installation:
|
2021-04-01 10:50:49 -04:00
|
|
|
-ea -Dopenjpa.ConnectionDriverName=org.postgresql.Driver -Dopenjpa.ConnectionURL=jdbc:postgresql://localhost:5432/openjpatst -Dopenjpa.ConnectionUserName=postgres -Dopenjpa.ConnectionPassword=postgres
|
2019-01-28 07:00:05 -05:00
|
|
|
|
|
|
|
For running against a MariaDB Docker installation:
|
|
|
|
-ea -Dopenjpa.ConnectionDriverName=org.mariadb.jdbc.Driver -Dopenjpa.ConnectionURL=jdbc:mariadb://localhost:3306/openjpatst -Dopenjpa.ConnectionUserName=root -Dopenjpa.ConnectionPassword=openjpatst
|
|
|
|
|
2019-01-30 16:33:08 -05:00
|
|
|
For running against a h2 based installation:
|
|
|
|
-ea -Dopenjpa.ConnectionDriverName=org.h2.Driver -Dopenjpa.ConnectionURL=jdbc:h2:./target/database/openjpa-h2-database -Dopenjpa.ConnectionUserName=root -Dopenjpa.ConnectionPassword=openjpatst
|
|
|
|
|
2019-02-06 04:23:02 -05:00
|
|
|
For running against a hsqldb based installation:
|
2021-04-04 07:51:21 -04:00
|
|
|
-ea -Dopenjpa.ConnectionDriverName=org.hsqldb.jdbcDriver -Dopenjpa.ConnectionURL=jdbc:hsqldb:mem:openjpa20-hsqldb-database -Dopenjpa.ConnectionUserName=sa -Dopenjpa.ConnectionPassword=
|
2019-02-06 04:23:02 -05:00
|
|
|
|
2021-03-31 13:09:03 -04:00
|
|
|
For running tests against a Microsoft SQLServer Docker based installation:
|
|
|
|
-ea -Dopenjpa.ConnectionDriverName=com.microsoft.sqlserver.jdbc.SQLServerDriver -Dopenjpa.ConnectionURL=jdbc:sqlserver://localhost:1433;sendTimeAsDatetime=false -Dopenjpa.ConnectionUserName=SA -Dopenjpa.ConnectionPassword=OpenJP8tst
|
2019-02-08 03:49:14 -05:00
|
|
|
|
2021-04-01 10:50:49 -04:00
|
|
|
For running against a Oracle Docker installation:
|
|
|
|
-ea -Dopenjpa.ConnectionDriverName=oracle.jdbc.driver.OracleDriver -Dopenjpa.ConnectionURL=jdbc:oracle:thin:@localhost:1521:xe -Dopenjpa.ConnectionUserName=openjpatst -Dopenjpa.ConnectionPassword=openjpatst
|
|
|
|
|
2019-01-28 07:00:05 -05:00
|
|
|
|
|
|
|
For starting tests in `openjpa-persistence-jdbc` inside a compiler you can also trigger all the enhancement manually via:
|
|
|
|
|
|
|
|
$> mvn process-test-classes
|