Difference between revisions of "Lyo/BuildingOSLC4J"

From Eclipsepedia

< Lyo
Jump to: navigation, search
(Run the StockQuote JUnit tests)
(Import OSLC4J Eclipse projects from the git repository)
(3 intermediate revisions by one user not shown)
Line 41: Line 41:
 
* Select the Import Existing Projects wizard and click next
 
* Select the Import Existing Projects wizard and click next
 
* Select all components of OSLC4J core.  The org.eclipse.lyo.core.query project is optional and not part of the core of OSLC4J at this point.
 
* Select all components of OSLC4J core.  The org.eclipse.lyo.core.query project is optional and not part of the core of OSLC4J at this point.
[[Image:Lyo-core-import-projects.png]]
 
  
 
== Build all projects ==
 
== Build all projects ==
Line 73: Line 72:
 
'''Note:''' the sample UIs for the Change Management sample provider have not yet been committed to Eclipse.  The delegated selection and creation dialogs will not work yet
 
'''Note:''' the sample UIs for the Change Management sample provider have not yet been committed to Eclipse.  The delegated selection and creation dialogs will not work yet
 
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
 
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
** Select the OSLC4JChangeManagement, OSLC4JChangeManagementCommon and OSLC4JChangeManagementTest projects.   The other projects in the rio repository are unrelated to OSLC4J.   See [[Lyo/LyoRIO|Lyo RIOs]] for information on these other reference implementations.
+
** org.eclipse.lyo.oslc4j.changemanagement
 +
** org.eclipse.lyo.oslc4j.changemanagement.common
 +
** org.eclipse.lyo.oslc4j.changemanagement.test
 
* Build each CM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
 
* Build each CM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
   * OSLC4JChangeManagementCommon
+
   * org.eclipse.lyo.oslc4j.changemanagement.common
   * OSLC4JChangeManagement
+
   * org.eclipse.lyo.oslc4j.changemanagement
   * OSLC4JChangeManagementTest
+
   * org.eclipse.lyo.oslc4j.changemanagement.test
 
* Go to Run->Run Configurations
 
* Go to Run->Run Configurations
 
* Expand the Maven Build section
 
* Expand the Maven Build section
Line 85: Line 86:
  
 
=== Run the Change Management JUnit tests ===
 
=== Run the Change Management JUnit tests ===
* Expand the OSLC4JChangeManagementTest project down to the Java source
+
* Expand the org.eclipse.lyo.oslc4j.changemanagement.test project down to the Java source
 
* Right click AllTests.java -> Run As -> JUnit test
 
* Right click AllTests.java -> Run As -> JUnit test
 
* Results will appear in the JUnit view
 
* Results will appear in the JUnit view
Line 92: Line 93:
 
'''Note:''' the sample UIs for the Quality Management sample provider have not yet been committed to Eclipse.  The delegated selection and creation dialogs will not work yet
 
'''Note:''' the sample UIs for the Quality Management sample provider have not yet been committed to Eclipse.  The delegated selection and creation dialogs will not work yet
 
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
 
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
** Select the OSLC4JQualityManagement, OSLC4JQualityManagementCommon and OSLC4JQualityManagementTest projects.  The other projects in the rio repository are unrelated to OSLC4J.  See [[Lyo/LyoRio|Lyo RIOs]] for information on these other reference implementations.
+
** Select the org.eclipse.lyo.oslc4j.qualitymanagement, org.eclipse.lyo.oslc4j.qualitymanagement.common and org.eclipse.lyo.oslc4j.qualitymanagement.test projects.  The other projects in the rio repository are unrelated to OSLC4J.  See [[Lyo/LyoRio|Lyo RIOs]] for information on these other reference implementations.
 
* Build each QM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
 
* Build each QM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
   * OSLC4JQualityManagementCommon
+
   * org.eclipse.lyo.oslc4j.qualitymanagement.common
   * OSLC4JQualityManagement
+
   * org.eclipse.lyo.oslc4j.qualitymanagement
   * OSLC4JQualityManagementTest
+
   * org.eclipse.lyo.oslc4j.qualitymanagement.test
 
* Go to Run->Run Configurations
 
* Go to Run->Run Configurations
 
* Expand the Maven Build section
 
* Expand the Maven Build section
Line 104: Line 105:
  
 
=== Run the Quality Management JUnit tests ===
 
=== Run the Quality Management JUnit tests ===
* Expand the OSLC4JQualityManagementTest project down to the Java source
+
* Expand the org.eclipse.lyo.oslc4j.qualitymanagement.test project down to the Java source
 
* Right click AllTests.java -> Run As -> JUnit test
 
* Right click AllTests.java -> Run As -> JUnit test
 
* Results will appear in the JUnit view
 
* Results will appear in the JUnit view
Line 111: Line 112:
  
 
*From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects&nbsp;:  
 
*From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects&nbsp;:  
**Select the OSLC4JAutomation, OSLC4JAutomationCommon and OSLC4JAutomationTest projects. The other projects in the rio repository are unrelated to OSLC4J. See [[Lyo/LyoRio|Lyo RIOs]] for information on these other reference implementations.  
+
**Select the org.eclipse.lyo.oslc4j.automation, org.eclipse.lyo.oslc4j.automation.common, and org.eclipse.lyo.oslc4j.automation.test projects. The other projects in the rio repository are unrelated to OSLC4J. See [[Lyo/LyoRio|Lyo RIOs]] for information on these other reference implementations.  
 
*Build each QM project by right clicking its pom.xml and selecting Run As-&gt;Maven install. Build them in this order:
 
*Build each QM project by right clicking its pom.xml and selecting Run As-&gt;Maven install. Build them in this order:
  
   * OSLC4JAutomationCommon
+
   * org.eclipse.lyo.oslc4j.automation.common
* OSLC4JAutomation
+
  * org.eclipse.lyo.oslc4j.automation
* OSLC4JAutomationTest
+
  * org.eclipse.lyo.oslc4j.automation.test
  
 
*Go to Run-&gt;Run Configurations  
 
*Go to Run-&gt;Run Configurations  
Line 126: Line 127:
 
=== Run the Automation JUnit tests  ===
 
=== Run the Automation JUnit tests  ===
  
*Expand the OSLC4JAutomationTest project down to the Java source  
+
*Expand the org.eclipse.lyo.oslc4j.automation.test project down to the Java source  
 
*Right click AllTests.java -&gt; Run As -&gt; JUnit test  
 
*Right click AllTests.java -&gt; Run As -&gt; JUnit test  
 
*Results will appear in the JUnit view
 
*Results will appear in the JUnit view
  
= The OSLC4JRegistry web application =
+
= The OSLC4J registry web application =
The OSLC4J StockQuote, Test, ChangeManagement and QualityManagement all use the OSLC4JRegistry web application as an OSLC Catalog.  When each application starts, it registers its OSLC service provider details with OSLC4JRegistry.   
+
The OSLC4J StockQuote, Test, ChangeManagement and QualityManagement all use the OSLC4J registry web application as an OSLC Catalog.  When each application starts, it registers its OSLC service provider details with the OSLC4J registry.   
  
The sample applications are currently configured to automatically launch the OSLC4JRegistry in the same application server as the sample application and register with this local OSLC4JRegistry instance.  If you wish to change this behavior and have the applications register with a remote OSLC4JRegistry, two changes are required.
+
The sample applications are currently configured to automatically launch the OSLC4J registry in the same application server as the sample application and register with this local OSLC4J registry instance.  If you wish to change this behavior and have the applications register with a remote OSLC4J registry, two changes are required.
  
 
* Edit the pom.xml for the sample application and remove the following lines:
 
* Edit the pom.xml for the sample application and remove the following lines:
Line 140: Line 141:
 
<contextHandlers>
 
<contextHandlers>
 
   <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
 
   <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
       <war>${basedir}/../../org.eclipse.lyo.core/OSLC4JRegistry/target/oslc4j-registry-0.1.1-SNAPSHOT.war</war>
+
       <war>${basedir}/../../org.eclipse.lyo.core/org.eclipse.lyo.oslc4j.registry/target/oslc4j-registry-0.1.1-SNAPSHOT.war</war>
 
       <contextPath>/OSLC4JRegistry</contextPath>
 
       <contextPath>/OSLC4JRegistry</contextPath>
 
       </contextHandler>
 
       </contextHandler>

Revision as of 16:54, 26 July 2013

Contents

Building and Running Lyo OSLC4J applications in Eclipse

Prerequisites

  • Eclipse 3.6 or higher IDE
  • EGit team provider for git (recommended) or git command line package.
  • m2eclipse for Maven support in the Eclipse IDE
  • OSLC4J requires a Java 1.6 compiler and Java 1.6 runtime. The Eclipse project settings have been set appropriately. If you are building outside of Eclipse, please use Java 1.6.

OSLC4J Sample Application runtimes

The OSLC4J sample applications now use a Jetty app server as the default runtime. The samples will also work in an Eclipse IDE using a Tomcat runtime. See the Eclipse documentation for instructions on creating a Tomcat server.

Note: If you're running these examples on Windows, make sure you don't have spaces in your workspace path. The samples might not launch.

Note: By default, these samples each run in a different Jetty instance and use the same ports. You can only run one at a time.

Options for running the OSLC4J Samples

You can develop and run OSLC4J samples one of 2 ways

  • Build OSLC4J and samples from source
  • Download the OSLC4J package with its dependencies here and add the jars to the classpath of your project

The remainder of this document explains the process for building from source.

Clone the Lyo Core and RIO (optional, for Change and Quality Management samples) git repositories

This example assumes EGit is being used

Lyo-core-git-repo.png

  • On the Branch Selection page, select the master branch
  • On the Local Destination page, specify a location or accept the default and click Finish

The repository should now show up in your Git Repositories view

Import OSLC4J Eclipse projects from the git repository

  • In the Git Repositories view, right click org.eclipse.lyo.core and select Import Projects
  • Select the Import Existing Projects wizard and click next
  • Select all components of OSLC4J core. The org.eclipse.lyo.core.query project is optional and not part of the core of OSLC4J at this point.

Build all projects

To build the core projects,

  • Expand the org.eclipse.lyo.oslc4j.build project
  • Right click pom.xml -> Run As -> Maven clean
  • Right click pom.xml -> Run As -> Maven install
  • IBM JVM/JRE Users: There is an issue with m2eclipse and the the IBM JRE. If you have see the error java.lang.NoClassDefFoundError: org.slf4j.impl.StaticLoggerBinder when running a Maven install, you need to copy a newer slf4j api jar into your JRE directory to work around the issue until it is fixed:

To build the stock quote sample and OSLC4J test projects, perform the same steps on the org.eclipse.lyo.oslc4j.test.build project.

Run the StockQuote sample application

Run the StockQuote JUnit tests

  • Expand the org.eclipse.lyo.oslc4j.stockquote.test project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view

Run the Change Management sample provider

Note: the sample UIs for the Change Management sample provider have not yet been committed to Eclipse. The delegated selection and creation dialogs will not work yet

  • From the Git Repository view, right click the git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git repository (browse it also on line) and import projects :
    • org.eclipse.lyo.oslc4j.changemanagement
    • org.eclipse.lyo.oslc4j.changemanagement.common
    • org.eclipse.lyo.oslc4j.changemanagement.test
  • Build each CM project by right clicking its pom.xml and selecting Run As->Maven install. Build them in this order:
  * org.eclipse.lyo.oslc4j.changemanagement.common
  * org.eclipse.lyo.oslc4j.changemanagement
  * org.eclipse.lyo.oslc4j.changemanagement.test

Run the Change Management JUnit tests

  • Expand the org.eclipse.lyo.oslc4j.changemanagement.test project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view

Run the Quality Management sample provider

Note: the sample UIs for the Quality Management sample provider have not yet been committed to Eclipse. The delegated selection and creation dialogs will not work yet

  • From the Git Repository view, right click the git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git repository (browse it also on line) and import projects :
    • Select the org.eclipse.lyo.oslc4j.qualitymanagement, org.eclipse.lyo.oslc4j.qualitymanagement.common and org.eclipse.lyo.oslc4j.qualitymanagement.test projects. The other projects in the rio repository are unrelated to OSLC4J. See Lyo RIOs for information on these other reference implementations.
  • Build each QM project by right clicking its pom.xml and selecting Run As->Maven install. Build them in this order:
  * org.eclipse.lyo.oslc4j.qualitymanagement.common
  * org.eclipse.lyo.oslc4j.qualitymanagement
  * org.eclipse.lyo.oslc4j.qualitymanagement.test

Run the Quality Management JUnit tests

  • Expand the org.eclipse.lyo.oslc4j.qualitymanagement.test project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view

Run the Automation sample provider

  • From the Git Repository view, right click the git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git repository (browse it also on line) and import projects :
    • Select the org.eclipse.lyo.oslc4j.automation, org.eclipse.lyo.oslc4j.automation.common, and org.eclipse.lyo.oslc4j.automation.test projects. The other projects in the rio repository are unrelated to OSLC4J. See Lyo RIOs for information on these other reference implementations.
  • Build each QM project by right clicking its pom.xml and selecting Run As->Maven install. Build them in this order:
  * org.eclipse.lyo.oslc4j.automation.common
  * org.eclipse.lyo.oslc4j.automation
  * org.eclipse.lyo.oslc4j.automation.test

Run the Automation JUnit tests

  • Expand the org.eclipse.lyo.oslc4j.automation.test project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view

The OSLC4J registry web application

The OSLC4J StockQuote, Test, ChangeManagement and QualityManagement all use the OSLC4J registry web application as an OSLC Catalog. When each application starts, it registers its OSLC service provider details with the OSLC4J registry.

The sample applications are currently configured to automatically launch the OSLC4J registry in the same application server as the sample application and register with this local OSLC4J registry instance. If you wish to change this behavior and have the applications register with a remote OSLC4J registry, two changes are required.

  • Edit the pom.xml for the sample application and remove the following lines:
<!-- Also start OSLC4JRegistry webApp -->
<contextHandlers>
   <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
      <war>${basedir}/../../org.eclipse.lyo.core/org.eclipse.lyo.oslc4j.registry/target/oslc4j-registry-0.1.1-SNAPSHOT.war</war>
      <contextPath>/OSLC4JRegistry</contextPath>
      </contextHandler>
</contextHandlers>
  • Add the following system property to the JVM arguments for the application launch:
    • -Dorg.eclipse.lyo.oslc4j.client.registryuri=http://<hostname>:<port>/OSLC4JRegistry/catalog/singleton (assuming a context of OSLC4JRegistry)

The system property can also be set by modifying the application code to set it directly, load it from a properties file, etc.