Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Building"

(Minimum GIT projects for JPA or Core EclipseLink project Development and Testing)
m (Documenting user specific build.properties file for IDEA)
(5 intermediate revisions by 2 users not shown)
Line 154: Line 154:
  
 
* foundation/eclipselink.core.test - the core testing for EclipseLink
 
* foundation/eclipselink.core.test - the core testing for EclipseLink
** Testing Browser.launch - runs legacy test browser.  Requires definition of JDBC_LIB and TOOLS_LIB classpath variables.
+
** Testing Browser.launch - runs legacy test browser.  Requires definition of JDBC_LIB classpath variables.
 
** SRGTestModel.launch - runs the SRG.  Requires definition of JDBC_LIB classpath variable
 
** SRGTestModel.launch - runs the SRG.  Requires definition of JDBC_LIB classpath variable
** LRGTestModel.launch - runs the LRG. Requires definition of JDBC_LIB and TOOLS_LIB classpath variables.
+
** LRGTestModel.launch - runs the LRG. Requires definition of JDBC_LIB classpath variables.
 
* foundation/eclipselink.extension.oracle.test - the testing for EclipseLink's Oracle-specific functionality.  
 
* foundation/eclipselink.extension.oracle.test - the testing for EclipseLink's Oracle-specific functionality.  
 
** Contains Testing Browser (Oracle).launch - Launches Legacy test browser in a manner that can run Legacy Oracle tests
 
** Contains Testing Browser (Oracle).launch - Launches Legacy test browser in a manner that can run Legacy Oracle tests
Line 186: Line 186:
  
 
All current dependencies can be found in the manifests for the PDE projects or in the bundles or in Problems view in Eclipse IDE.
 
All current dependencies can be found in the manifests for the PDE projects or in the bundles or in Problems view in Eclipse IDE.
 +
 +
== Alternative IDEs ==
 +
 +
=== IntelliJ IDEA ===
 +
 +
This guide has been built using IntelliJ IDEA version 13 on Windows.
 +
 +
==== Prerequisites ====
 +
 +
* An existing [https://www.eclipse.org/downloads/ eclipse] installation
 +
* [http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html Java 7 SDK]
 +
* [http://git-scm.com/downloads Git client]
 +
* [http://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar hamcrest-core-1.3.jar]
 +
* [http://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11.jar junit.jar]
 +
 +
==== Downloading eclipselink sources ====
 +
 +
Under '''VCS''' menu, select '''Checkout from Version Control''' and '''Git''' version control system. In the dialogue window that opens, enter '''git@orahub.oraclecorp.com:fmw-infra-toplink/eclipselink-runtime.git''' URL, fill in '''Parent Directory''' and '''Directory Name''' fields  and click the '''Clone''' button. This process may take a while to complete.
 +
 +
[[File:Git_clone_IDEA.jpg]]
 +
 +
- ''For Parent Directory and Directory Name combination it is advised to not enter a long path in case of importing the project in a Windows system. A Parent Directory of C:\dev and Directory Name of eclipselink is enough.''
 +
 +
- ''You should click Test to verify connection settings. In case of failure, check whether a proxy server should be used. It should be enough to select Auto-detect proxy settings under IDE Settings - File menu -> Settings -> IDE Settings -> HTTP Proxy -> Auto-detect proxy settings.''
 +
 +
==== Setting up IDEA project ====
 +
 +
After downloading sources, a dialogue appears to create an IntelliJ IDEA project from the source files downloaded. Select '''Import project from external model''' and '''Eclipse'''. Clicking '''Next''' will initiate a scan of source files and a list of available projects will be displayed. Click '''Unselect all''' and select the following projects:
 +
 +
* eclipselink.core.test
 +
* eclipselink.jpa.modelgen.test
 +
* eclipselink.jpa.test
 +
* eclipselink.moxy.test
 +
* org.eclipse.persistence.core
 +
* org.eclipse.persistence.jpa
 +
* org.eclipse.persistence.moxy
 +
* org.eclipse.persistence.moxy.dynamicxjc
 +
* org.eclipse.persistence.nosql
 +
 +
- ''You can import additional projects at any time selecting Import Module… dialogue under File menu''
 +
 +
You will then be asked to select the project SDK. Select a Java 7 or Java 8 SDK and click '''Finish'''. At this point IDEA will create an '''ECLIPSE''' library. You need to provide the '''path to the eclipse installation'''. For '''ECLIPSELINK_HOME''' and '''MAVEN_REPOSITORY''' path variables, enter the '''project root''' directory and '''path to .m2/repository (M2_HOME)''' respectively.
 +
 +
==== Configuring project ====
 +
 +
Under '''File''' menu, select '''Project Structure'''. Inside '''Project''' panel, '''Change Project language level''' to '''7.0'''.
 +
 +
[[File:Project_sdk.jpg]]
 +
 +
Inside '''Modules''' panel, for every project module you need to '''change Module SDK''' to '''Project SDK''' and click '''OK'''.
 +
 +
[[File:Module_dependencies.jpg]]
 +
 +
- ''(Language level change will require a project re-import to apply)''
 +
 +
At this point, we need to run an ant build for test dependencies to be created.
 +
 +
Initially, a folder needs to be created at the same level as the project root called '''extension.lib.external''' (<project root>/../extension.lib.external). Files '''hamcrest-core-1.3.jar''' and '''junit.jar''' (a file rename may be needed) will need to be copied to that location.
 +
 +
Then, a user specific properties file needs to be created in the user home directory. To do so, create a '''build.properties''' file in your '''user home directory''' (usually C:\Documents and Settings\<username> on Windows) adding the following line:
 +
 +
'''junit.lib=<path to extension.lib.external>/junit.jar:<path to extension.lib.external>/hamcrest-core-1.3.jar'''
 +
 +
Now, in '''Project''' panel, find '''antbuild.xml''' file and '''right click''', selecting '''Add as Ant Build File'''. Build targets will appear in Ant Build panel.
 +
 +
[[File:Ant_panel.jpg]]
 +
 +
Double click '''build''' target and wait for the build process to finish.
 +
 +
[[File:Build_messages.jpg]]
 +
 +
- ''(You can check the progress of the build in Messages panel)''
 +
 +
After build has finished successfully, open '''Project Structure''' dialogue again and correct broken jar paths for '''eclipselink.jpa.modelgen.test''' module. For every broken path, click '''Add''' button and find the applicable jar file under '''<project root>/jpa/eclipselink.jpa.test'''. After adding the correct file, you may '''Remove''' the broken link.
 +
 +
[[File:Jpa_test_dependency.jpg]]
 +
 +
For '''org.eclipse.persistence.moxy''' module, click '''Add''' and select '''Jars or directories'''. Under '''<project root>/plugins''', select the following files:
 +
 +
* javax.validation_1.1.0.v201304101302.jar
 +
* jaxb-core_2.2.11.v201407311112.jar
 +
* jaxb-xjc_2.2.11.v201407311112.jar
 +
 +
For '''eclipselink.jpa.test''' module, click '''Add''', select '''Jars or directories''' and select the path to '''hamcrest-core-1.3.jar''' and click '''OK'''.
 +
 +
At this point you should be able to select '''Make Project''' under '''Build''' menu without errors.

Revision as of 09:11, 4 October 2014

Git Structure

EclipseLink code has migrated from SVN to Git. The SVN repository has been split into several repositories. The repository list, descriptions, and urls can be found at: http://git.eclipse.org under the EclipseLink project list.

Runtime

The below is a description of the content of the directories. Note: All projects are Eclipse PDE projects and therefore classpath dependencies are defined in the manifest rather than the project metadata.

Plugins

The plugins directory contains all the common dependencies needed by all the projects. You can make use of them by either importing the Eclipse projects for all the depenencies or by making the bundle jars (all the jars) in this directory available to Eclipse's target platform. You can do that by adding a directory that contains those jars to your Target Platform under "Preferences -> Plug-in Development -> Target Platform", or by copying them to your Eclipse installation's plugin's directory.

The following dependencies can also be obtained from Orbit.

  • commonj.sdo 2.1.1
  • javax.activation 1.1.0
  • javax.mail 1.4.0
  • javax.persistence 1.0.0
  • javax.servlet 2.4.0
  • javax.wsdl 1.6.2
  • javax.xml.bind 2.0.0
  • javax.xml.rpc 1.1.0
  • javax.xml.stream 1.0.1
  • javax.xml.ws 2.1.0
  • org.apache.ant 1.7.0

Instructions about getting bundles from Orbit

Foundation

  • org.eclipse.persistence.core - All other EclipseLink components depend on this bundle. You will need to import this project to work on other EclipseLink components. All other components can be imported separately.
  • org.eclipse.persistence.oracle - extensions that require Oracle-specific libraries for compilation. If you do not have the required oracle libraries, you can get the compiled classes since they are checked in. This bundle is only used for advanced Oracle-specific functionality and not required unless you are using that functionality.
    • The oracle bundle requires that you configure the oracle target within your Eclipse. To do that, you will need to do the following:
      • Find the target.oracle directory in foundation/targets
      • Obtain the Oracle dependency jars and put them into oracle.libs folder. There is a list of them in the manifest found in oracle.libs. Note: These are not currently available in open-source format and you will have to obtain them from Oracle
      • Import the target.oracle directory and its contents into Eclipse as a Plug-in fragment

JPA

  • org.eclipse.persistence.jpa - EclipseLink's JPA support
  • plugins - The additional dependencies for JPA support

MOXY

  • org.eclipse.persistence.moxy - EclipseLink's Object-XML support
  • plugins - The additional dependencies for Object-XML support

SDO

  • org.eclipse.persistence.sdo - EclipseLink's SDO support
  • plugins - The additional dependencies for SDO support

DBWS

  • org.eclipse.persistence.dbws - EclipseLink's Database Webservice support
  • plugins - The additional dependencies for DBWS support

Build

Importing the projects into Eclipse will build the class files for the PDE projects. Most functionality will be accessible after those builds. Ant files are also provided both for use in a non-Eclipse IDE, and for commandline use. If you want to do a complete build of the EclipseLink artifacts, the steps are outlined In the "building with Ant" section below.

Building with Ant

Ant is used to drive all builds for the EclipseLink Project. Furthermore, it is assumed that EclipseLink will be built (ant tested) in environments other than the Eclipse IDE (PDE build). Therefore, the Ant buildfiles are designed to be used from many entry points with varying configurations. However, starting with 2.4, we have moved to a manifest-first approach to build our OSGi bundles. Therefore, rather than using BND to generate the OSGi manifest post build we are using Tycho (a maven plugin) to generate our OSGi bundles.

Below are the steps to setup for and then run a basic build of EclipseLink using the Ant buildfiles from the trunk.

Environment Setup

Most of the required dependencies are already existent in one of the previously discussed plugin folders. However, there are some third-party files that are not supplied. Specifically:

  • Ant 1.9.x for 2.6.0, Ant 1.7 for earlier versions.
    • Our build scripts don't work properly under 1.8.
    • If not already installed, you will need to download and install it.
  • Maven 3 for EclipseLink 2.4+ (Tycho requires Maven 3 functionality).
    • If not already installed, you will need to download and install it.
  • Make sure you have an "ANT_HOME", "M2_HOME" and "JAVA_HOME" environment variables pointing to appropriate folders.
  • Junit 4.11 (or higher)
  • Any library licensed under an agreement that is not EPL or Eclipse approved. This includes Oracle libraries and 3rd party libraries needed to compile specific extensions
  • BND tool (2.3.x and earlier only)- we use bnd to generate our OSGi plugins in EclipseLink 2.3.x and earlier. Version .366 or later should work fine if placed in the extension.depend.dir or the buildsystem dir. In addition, if bnd is not available the build will attempt to generate meaningful OSGi manifests, but there are known shortcomings and issues with this approach.
    • Add the following entry to your user-dir/build.properties
      • bndtool.jar=bnd-0.0.384.jar as of 20100513
      • bndtool.lib=bnd-0.0.384.jar as of at least 2.4.2


The build provides mechanisms to incorporate these dependencies outside of Git. build defaults: The build assumes certain defaults for dependencies. These can be overridden, but are provided to allow minimal configuration setup.

  • external dependency location: The build assumes that all dependant libraries external to Git are stored in one of two default locations.
  • extensions.depend.dir: This property defines where external dependencies can be found. (default: .\trunk\..\extension.lib.external)
  • oracle.extensions.depend.dir: This is a legacy property for compatability with Oracle testing scripts. It is used to define the location of Oracle specific jars. (default: .\trunk\..\extension.oracle.lib.external)
  • library properties: Most dependant libraries are defined using a property definition that can be overridden
Overriding Defaults

Basic Setup

  • It may be necessary to create a user specific properties file to override the default values in <trunk>/build.properties. To do so, create a build.properties file in your user home directory (usually C:\Documents and Settings\<username> on windows). Variables commonly needing redefinition in it are:
    • For build:
    • For Test
      • jdbc.driver.jar=<full path to your JDBC driver>
      • db.driver=<classname of your JDBC driver>
      • db.url=<JDBC url of your DB>
      • db.user=<db username>
      • db.pwd=<db password>
      • (optional) db.platform=<EclipseLink Database Platform to use> - this is only necessary if EclipseLink does not properly dectect you DB with its database detection
  • Open a command prompt in your checked out trunk directory
  • Run "ant" (or "ant -f antbuild.xml" in 2.4 or later) for a full build of all core and test code
  • or
  • use the "build-eclipselink-jar" task for a full build of only core code

These commands will build the Runtime and/or the tests. Tests can also be run by adding a test execution target (like test-srg).

Note: Several DBWS component's build files are dependant upon JDK 1.6 (JDK 5 can be used but these components won't build)

Updating dependencies

In order to update EclipseLink's dependencies, take these steps:

  1. Prepare the dependency bundle. All product dependencies need to be OSGi bundles: so they need an OSGi manifest, and to be named appropriately: <bundleprefix>_<bundleversion>.<builddate>.jar.
  2. Verify the bundle by building the EclipseLink with it:
    1. Override the default remote compdeps setting to "local.compdeps=true" in your $home/build.properties file.
    2. Add the new bundle to /plugins or /<module>/plugins (as appropriate).
    3. Update antbuild.xml in buildsystem/compdeps.
    4. Update features.xml in buildsystem/compdeps/org.eclipse.persistence.compdeps.
    5. Update your module's MANIFEST.MF file to Import-Package your new dependency.
  3. Once your plugin passes the build, you need to create a CQ (e.g. https://dev.eclipse.org/ipzilla/show_bug.cgi?id=8334). If you are on a tight schedule, I recommend doing this step ahead of the others, since it may take some time before the CQ is approved.
  4. When the CQ is approved, create a bug on eclipse (e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=438761) and submit a patch containing the changes.
  5. After the patch is pushed, contact the EL Releng team and ask them to update the p2 index.

For more detailed description see:

Testing

Tests can be run through Ant or in Eclipse

From Ant

In the trunk directory, you can use the following targets to run tests:

  • test-srg - Basic "smoke tests"
  • test-lrg - Full test model - must be run sucessfully on either MySQL or Oracle before checking in any changes to core classes
  • test-core - subset of tests just for the core
  • test-core-srg - smoke tess for the core
  • test-jpa - runs JPA tests - required prior to check-in for any changes to JPA included in "test-lrg"
    • JPA tests require some artifacts from the build in order to be able to run. There are two ways to get them.
      • Run the full build as indicated above
      • From the org.eclipse.persistence.jpa directory, run "ant"
    • This will create a directory required by the tests and the jars that contain the models. You only need to rebuild if you are adding or subtracting from the models (Package org.eclipse.persistence.testing.models.jpa and its subpackages).
  • test-wdf - runs the "WDF" JPA test suite (JPA tests contributed by SAP (Walldorf, Germany)).
  • test-moxy - runs MOXY tests - required prior to check-in for any changes to MOXY included in "test-lrg"
  • test-jaxb - required prior to check-in for any changes to JAXB included in "test-moxy"
  • test-oxm - required prior to check-in for any changes to OXM included in "test-moxy"
  • test-sdo - required prior to check-in for any changes to SDO included in "test-lrg"

From Eclipse

The following directories contain projects with tests

  • foundation/eclipselink.core.test - the core testing for EclipseLink
    • Testing Browser.launch - runs legacy test browser. Requires definition of JDBC_LIB classpath variables.
    • SRGTestModel.launch - runs the SRG. Requires definition of JDBC_LIB classpath variable
    • LRGTestModel.launch - runs the LRG. Requires definition of JDBC_LIB classpath variables.
  • foundation/eclipselink.extension.oracle.test - the testing for EclipseLink's Oracle-specific functionality.
    • Contains Testing Browser (Oracle).launch - Launches Legacy test browser in a manner that can run Legacy Oracle tests
  • jpa/eclipselink.jpa.test - the JPA tests for EclipseLink
    • See the description of the test-jpa target above for a prerequisite.
    • FullRegressionTestSuite.launch - runs JPA tests
      • Needs DB properties to run. either of the following can be done to give the DB properties:
        • Add a JVM argument: -Dtest.properties=<full path to build.properties in your user home>
        • update the test.properties file in jpa/eclipselink.jpa.test directory to point at correct DB
    • Testing Browser (JPA).launch - Launches Legacy test browser in a manner that can run JPA tests through that browser
      • Note: Recompilation of eclipselink.jpa.test test jars are required only if new classes were added/deleted since the last build.
  • jpa/eclipselink.spring.test - Spring specific JPA testing
  • moxy/eclipselink.moxy.test - MOXY testing
  • sdo/eclipselink.sdo.test - SDO testing
  • dbws/eclipselink.dbws.test - DBWS Testing

Minimum GIT projects for JPA or Core EclipseLink project Development and Testing

  • The following import screen capture from Eclipse 4.4 details the minimum projects you will need in order to do JPA or Core development in Eclipse.

Eclipselink-projects-corejpa.png

  • Before importing any test project into Eclipse, make sure you run full Ant build in order to let Eclipse resolve local test related dependencies
  • The following screens details the minimum test projects related to JPA and/or Core development in Eclipse.

Eclipselink-projects-corejpa-tests.png

  • Note: Also add the org.eclipse.persistence.moxy project (a requirement of eclipselink.jpa.test)
  • Note: Also define "ECLIPSELINK_HOME" classpath variable (Java | Build Path | Classpath Variables) pointing to your local Git clone root folder

Projects and Dependencies

When using the Eclipse IDE - a Luna or later EE version is required. See the Eclipse download site for information http://www.eclipse.org/downloads

All current dependencies can be found in the manifests for the PDE projects or in the bundles or in Problems view in Eclipse IDE.

Alternative IDEs

IntelliJ IDEA

This guide has been built using IntelliJ IDEA version 13 on Windows.

Prerequisites

Downloading eclipselink sources

Under VCS menu, select Checkout from Version Control and Git version control system. In the dialogue window that opens, enter git@orahub.oraclecorp.com:fmw-infra-toplink/eclipselink-runtime.git URL, fill in Parent Directory and Directory Name fields and click the Clone button. This process may take a while to complete.

Git clone IDEA.jpg

- For Parent Directory and Directory Name combination it is advised to not enter a long path in case of importing the project in a Windows system. A Parent Directory of C:\dev and Directory Name of eclipselink is enough.

- You should click Test to verify connection settings. In case of failure, check whether a proxy server should be used. It should be enough to select Auto-detect proxy settings under IDE Settings - File menu -> Settings -> IDE Settings -> HTTP Proxy -> Auto-detect proxy settings.

Setting up IDEA project

After downloading sources, a dialogue appears to create an IntelliJ IDEA project from the source files downloaded. Select Import project from external model and Eclipse. Clicking Next will initiate a scan of source files and a list of available projects will be displayed. Click Unselect all and select the following projects:

  • eclipselink.core.test
  • eclipselink.jpa.modelgen.test
  • eclipselink.jpa.test
  • eclipselink.moxy.test
  • org.eclipse.persistence.core
  • org.eclipse.persistence.jpa
  • org.eclipse.persistence.moxy
  • org.eclipse.persistence.moxy.dynamicxjc
  • org.eclipse.persistence.nosql

- You can import additional projects at any time selecting Import Module… dialogue under File menu

You will then be asked to select the project SDK. Select a Java 7 or Java 8 SDK and click Finish. At this point IDEA will create an ECLIPSE library. You need to provide the path to the eclipse installation. For ECLIPSELINK_HOME and MAVEN_REPOSITORY path variables, enter the project root directory and path to .m2/repository (M2_HOME) respectively.

Configuring project

Under File menu, select Project Structure. Inside Project panel, Change Project language level to 7.0.

Project sdk.jpg

Inside Modules panel, for every project module you need to change Module SDK to Project SDK and click OK.

Module dependencies.jpg

- (Language level change will require a project re-import to apply)

At this point, we need to run an ant build for test dependencies to be created.

Initially, a folder needs to be created at the same level as the project root called extension.lib.external (<project root>/../extension.lib.external). Files hamcrest-core-1.3.jar and junit.jar (a file rename may be needed) will need to be copied to that location.

Then, a user specific properties file needs to be created in the user home directory. To do so, create a build.properties file in your user home directory (usually C:\Documents and Settings\<username> on Windows) adding the following line:

junit.lib=<path to extension.lib.external>/junit.jar:<path to extension.lib.external>/hamcrest-core-1.3.jar

Now, in Project panel, find antbuild.xml file and right click, selecting Add as Ant Build File. Build targets will appear in Ant Build panel.

Ant panel.jpg

Double click build target and wait for the build process to finish.

Build messages.jpg

- (You can check the progress of the build in Messages panel)

After build has finished successfully, open Project Structure dialogue again and correct broken jar paths for eclipselink.jpa.modelgen.test module. For every broken path, click Add button and find the applicable jar file under <project root>/jpa/eclipselink.jpa.test. After adding the correct file, you may Remove the broken link.

Jpa test dependency.jpg

For org.eclipse.persistence.moxy module, click Add and select Jars or directories. Under <project root>/plugins, select the following files:

  • javax.validation_1.1.0.v201304101302.jar
  • jaxb-core_2.2.11.v201407311112.jar
  • jaxb-xjc_2.2.11.v201407311112.jar

For eclipselink.jpa.test module, click Add, select Jars or directories and select the path to hamcrest-core-1.3.jar and click OK.

At this point you should be able to select Make Project under Build menu without errors.

Back to the top