Building an Institutional Plugin using Maven

Overview

The purpose of this tutorial is to familiarize Kuali Rice developers with building institutional plugins that override out-of-the-box Rice services. This tutorial focuses on overriding the IdentityService as an example.

Prerequisites

  1. Download Rice Foundation Codebase into <workspace>\rice-0.9.4
  2. Configure Maven Repository

    Environment Variable

    Description

    Example

    M2_HOME

    Maven Home

    C:\apache-maven-2.0.9

    M2_OPTS

    JVM Options

    -Xms256m -Xmx512m

    M2_REPO

    Repository Location

    C:\JavaLib\mvnrepository

Development Environment

Build Sheet

Create Maven Project

  1. At a command prompt, navigate to your <workspace> (e.g. C:\Development\KualiRice.workspace)
  2. Create a web application project using the maven-archetype-quickstart archetype
    <workspace> mvn archetype:create -DgroupId=edu.ucdavis.iet.kuali.rice -DartifactId=ucd-kim-impl -DarchetypeArtifactId=maven-archetype-quickstart
    

    This creates a directory named ucd-kim-impl (after the artifactId) in your <workspace>

  3. Navigate to the ucd-kim-impl subdirectory and generate the Eclipse project
    <workspace>\ucd-kim-impl> mvn eclipse:eclipse
    

Import into Eclipse

  1. Go to File -> Import -> Existing projects into Workspace
  2. Select <workspace>\ucd-kim-impl as the root directory and click Finish

Configure POM

  1. Define base properties:

    groupId

    edu.ucdavis.iet.kuali.rice

    artifactId

    ucd-kim-impl

    packaging

    jar

    version

    1.0.0

    name

    ucd-kim-impl

  2. Add dependency properties:

    spring.version

    2.0.4

    spring-ldap.version

    1.3.0.RELEASE

    commons-lang.version

    2.3

    rice-api.version

    0.9.4-SNAPSHOT

    rice-impl.version

    0.9.4-SNAPSHOT

    db-ojb.version

    1.0.4-patch2

    servlet-api.version

    2.4

    xalan.version

    2.4.0

    iet-ldap-widget.version

    1.0.0

  3. Add dependencies:
    • Spring LDAP Core
    • Spring
    • Rice API
    • Rice Implementation
    • Common Lang
    • DB OJB
    • Servlet API
    • Xalan-J
    • IET LDAP Widget
  4. Add repository for Spring LDAP Core

Declare Spring Beans

Configure Dependencies on the Build Path

Method A:
  1. In the Java Build Path dialog box, click on the Libraries tab
  2. Click Add Variable
  3. Select M2_REPO and click OK
  4. Select the variable you just added and click Edit, then Extenstion
  5. Select the appropriate JAR from the Maven repository hierarchy (e.g. spring-2.5.5.jar will be in org/spring/framework/spring/2.5.5)
  6. Repeat for all other dependencies

    If the JAR you want is not already in your local Maven repository, you must install it using mvn:install
    For example, to install Rice API and Rice Implementation:

    mvn install:install-file -DgroupId=org.kuali.rice -DartifactId=rice-api -Dversion=0.9.4-SNAPSHOT -Dpackaging=jar -Dfile=<workspace>\rice-0.9.4\api\target\rice-api-0.9.4-SNAPSHOT.jar
    
    mvn install:install-file -DgroupId=org.kuali.rice -DartifactId=rice-impl -Dversion=0.9.4-SNAPSHOT -Dpackaging=jar -Dfile=<workspace>\rice-0.9.4\impl\target\rice-impl-0.9.4-SNAPSHOT.jar
    
Method B:
  1. In the Java Build Path dialog box, click on the Libraries tab
  2. Click Add External JARs
  3. Select the appropriate JAR from your file system (e.g. C:\JavaLib\spring-framework-2.5.5\dist\spring.jar)
  4. Repeat for all other dependencies
    • Method A works well if you want to perform the Maven builds yourself.
    • Method B works well if you use a continuous integration system like Bamboo to perform the Maven builds.

Build the JAR

Method A:
  1. Compile the source code by selecting Project -> *Build Project (alternatively, configure Eclipse to always Build Automatically)
  2. At the command prompt, create a JAR from the compiled code
    <workspace>\ucd-kim-impl> mvn jar:jar
    

    This is in lieu of com.sun.tools.javac.code.Symbol$CompletionFailure: file javax\persistence\Table.class not found error.

Deploy to local Maven Repository

Configure the Rice POM

Build the Rice WAR