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
- Download Rice Foundation Codebase into <workspace>\rice-0.9.4
- 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
- At a command prompt, navigate to your <workspace> (e.g. C:\Development\KualiRice.workspace)
- 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>
- Navigate to the ucd-kim-impl subdirectory and generate the Eclipse project
<workspace>\ucd-kim-impl> mvn eclipse:eclipse
Import into Eclipse
- Go to File -> Import -> Existing projects into Workspace
- Select <workspace>\ucd-kim-impl as the root directory and click Finish
Configure POM
- Define base properties:
groupId
edu.ucdavis.iet.kuali.rice
artifactId
ucd-kim-impl
packaging
jar
version
1.0.0
name
ucd-kim-impl
- 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
- Add dependencies:
- Spring LDAP Core
- Spring
- Rice API
- Rice Implementation
- Common Lang
- DB OJB
- Servlet API
- Xalan-J
- IET LDAP Widget
- Add repository for Spring LDAP Core
Declare Spring Beans
Configure Dependencies on the Build Path
Method A:
- In the Java Build Path dialog box, click on the Libraries tab
- Click Add Variable
- Select M2_REPO and click OK
- Select the variable you just added and click Edit, then Extenstion
- 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)
- 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:
- In the Java Build Path dialog box, click on the Libraries tab
- Click Add External JARs
- Select the appropriate JAR from your file system (e.g. C:\JavaLib\spring-framework-2.5.5\dist\spring.jar)
- 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:
- Compile the source code by selecting Project -> *Build Project (alternatively, configure Eclipse to always Build Automatically)
- 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.