Fork me on GitHub

n. Slang a rough lawless young Kuali developer.
[perhaps variant of Houlihan, Irish surname]
kualiganism n

Blog of an rSmart Java Developer. Full of code examples, solutions, best practices, et al.

Monday, February 27, 2012

Building Applications with the Kuali POMs


The Kuali Rice team has been investing a lot recently into Maven standardization. That is, bringing projects together more cohesively via Maven. It is not just to have all projects using Maven, but also using the same plugins, licensing, dependencies and so on with Maven. The best solution as of late is one Mother POM. In Maven, it's conveniently named a parent POM. Rice has two right now (Kuali and Kuali Common). Documentation to these can conveniently be found on the Kuali Foundation Wiki.

This post is for projects that are looking to get started really quickly with setting up a project at the Kuali Foundation. While documentation is available on the wiki, I am going through this on my blog as an outsider. Some of this is also pertinent to institutions that wish to implement Kuali Software. While these POM files do simplify things for foundation projects, institutions that use these parent POM files may encounter some caveats.


I Want to Start a New Project. Now What?

Just create your project normally. Make sure your POM has this in it.
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

You will automatically get all of the Kuali Maven Configuration. This means that all of the nexus configuration comes as well. This includes deployment urls and usernames. No passwords are included in the configuration. Passwords are expected to be setup in a wagon configuration via the settings.xml. Therefore, if your project is not a Kuali Foundation project with that settings.xml setup properly, you will probably encounter a number of errors. For example, see below:

[INFO] ------------------------------------------------------------------------
[INFO] Building kfs 4.1.1-maven-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-jar-plugin:2.3.2:test-jar (test-jar) @ kfs-parent ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ kfs-parent ---
[INFO] Installing /Users/leo/projects/git/kfs-maven/kfs-parent/pom.xml to /Users/leo/.m2/repository/org/kuali/kfs/kfs-parent/4.1.1-maven-SNAPSHOT/kfs-parent-4.1.1-maven-SNAPSHOT.pom
[INFO] Installing /Users/leo/projects/git/kfs-maven/kfs-parent/target/kfs-parent-4.1.1-maven-SNAPSHOT-tests.jar to /Users/leo/.m2/repository/org/kuali/kfs/kfs-parent/4.1.1-maven-SNAPSHOT/kfs-parent-4.1.1-maven-SNAPSHOT-tests.jar
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ kfs-parent ---
Downloading: s3://
[WARN] s3:// - Connection refused
[WARNING] Could not transfer metadata org.kuali.kfs:kfs-parent:4.1.1-maven-SNAPSHOT/maven-metadata.xml from/to kuali.snapshot (s3:// The S3 wagon needs AWS Access Key set as the username and AWS Secret Key set as the password. eg:

[AWS Access Key ID]
[AWS Secret Access Key]

[INFO] Logged off -

Above is the result of a missing or even misconfigured settings.xml. What is missing are the keys for s3-based maven repository. This isn't something you want to fix, this is something you want to configure. Let's consider this is not a Kuali Foundation project, then what needs to occur is the <distributionManagement ... /> section needs to be configured within the POM.xml
      <name>Kuali Maven Site</name>
The above properties can be overridden at build time. If you with for your kfs-maven project to deploy somewhere else within your organization so that you may build an overlay from it, then you will want to override these properties. A few other properties I use are:

-Dkuali.cloudfront.phase=none -Dkuali.gpg.phase=none -Dkuali.cloudfront.phase=none -Dksite.phase=none

For a list of other properties that can be overridden, please refer to Kuali Community Maven POM Properties

Typically, properties follow the patterns:
  • <artifactId^gt;.version The version property pattern
  • <artifactId>.goal.phase phase property pattern
For more about what these are and what they're used for, see Kuali Community Maven POM Patterns and Conventions

The kfs-public POM

This isn't an official POM yet. I am hoping to get it added to the Kuali Repository soon, but even if it is not added to the Kuali Repository, you can add it to your own local repository. You can find the kfs-public POM here at GitHub. It is pretty much the same as the kuali-common POM, except that it overrides all of the things I was mentioning earlier to make it usable for public consumption. That is, non-Kuali Foundation projects.

No comments:

Post a Comment