05 Exercise - Installing the uPortal Maven Repository

Exercise

This page is a different kind of uPortal manual page, a hands-on exercise. It may be helpful to you to use this exercise in the context of this manual. It also may serve as a template for building uPortal training materials.

Purpose of this exercise

This exercise provisions your local Maven repository with the dependencies necessary to work with uPortal. It is a way to quickly bootstrap your Maven-managed uPortal dependencies when you first set up a uPortal environment, avoiding asking Maven to find and download the dependencies individually.

If you're not in an organized development class and don't have access to a friend's already populated Maven repository, then this page probably isn't very useful to you.

This exercise helps introduce where Maven 2 stores its dependencies.

Pre-requisites for this exercise

  • A working, installed, suitable version of Maven 2 (e.g., that included in the uPortal 3 Quickstart)
  • A populated Maven 2 repository directory (the purpose of this exercise is to install this directory, which you would get from an instructor or from another developer who has already worked with uPortal and downloaded the dependencies via Maven)

Stepwise instructions

Step 0: Have a new repository directory to install

This exercise won't work if someone is not providing you a ready-to-go "repository" directory. If you don't have access to one of those, stop now, because you won't be able to complete this exercise.

Step 1: Move aside an existing repository

If you've already got a Maven 2 repository, it might be valuable to you. It would be best to move it aside so that it's handy for you to restore later.

Your Maven2 repository will live in your home directory, in a folder named ".m2". Folders with names starting with a dot may not be visible in your environment by default. You may need to "show hidden" or do an "ls -a" to see it. If the .m2 folder exists, it may have a subfolder named "repository". If it does, move that someplace safe so you can put it back when you're done with the seminar.

Moving aside an existing repository
andrew-petros-macbook:~ apetro$ cd
andrew-petros-macbook:~ apetro$ pwd
/Users/apetro
andrew-petros-macbook:~ apetro$ ls -a
.			.elive-academic.props	Movies
..			.m2			Music
.CFUserTextEncoding	.ssh			Pictures
.DS_Store		.subversion		Public
.Trash			Desktop			Send Registration
.bash_history		Documents		Sites
.cups			Downloads		ant165
.eclipse_keyring	Library
andrew-petros-macbook:~ apetro$ cd .m2
andrew-petros-macbook:.m2 apetro$ ls
repository
andrew-petros-macbook:.m2 apetro$ mv ./repository ./old_repository

Step 2: Copy the given repository into place

In order for this exercise to be useful, you need access to a pre-populated Maven2 repository directory suitable for uPortal 3. This was provided to uPortal seminar participants at JA-SIG St. Paul 2008 and has been available via the USB mass storage drives Eric Dalquist and Andrew Petro have been passing around.

Copy the pre-populated Maven 2 repository directory (named "repository") to your home directory in a folder named ".m2", resulting in:

~/.m2/repository/

Copying the repository directory into place
cp -R /up3seminar/04_Building/repository ~/.m2/

Step 3: Try it out

Enter the uPortal 3 source directory and run the Maven 2 "test" target to verify that Maven 2 can find the uPortal dependencies and run a Maven command. With the repository installed, this command won't need to download a large number of dependencies from Maven.

If you've unzipped the uPortal 3 quickstart into a root directory named "up3", then running this command looks like this:

Running the Maven 2 "test" target on uPortal 3
cd /up3/uPortal-3.0.0-quick-start/uPortal-3.0.0
/up3/uPortal-3.0.0-quick-start/apache-maven-2.0.8/bin/mvn test

Step 4: Restore your original repository

If you moved aside a previous repository in step 1, you may wish to restore it into place after you're done working with uPortal 3, or you may want to merge these directories.