In the 2,7 release several tools will have their own release and be deployed by assemblies, much the way that the kernel package in 2.6. This will requireinstitutions deploying Sakai to re-examine some of their practices. While doing this we want to:
1)Speed up our build times by not building code unessesarily
2)be sure of what versions of code we deploy to our production environment
3)simplify our build processes.
The case I shall be considering is:
"At foo.edu we have modifications to the Test & Quizzes help documentation to meet local needs." (This is a simplification of a use case Seth Theriault posted to sakai-dev a while back - well get to Seth's full case in a follow up post).
Now this kind of change is probably fairly common and usually has some notable feature of being a stable change - you make it once at the start of the release cycle. This makes our job somewhat easier. I shall also be assuming that we are working against released jars, again I shall write about tracking a maintenance branch in a later post.
To achieve our goal we need to:
1)Build our custom help jar
2)build a custom assembly
3)deploy that assembly to our maven repository
First off lets set up a svn project to do this, I'll be using a msub location but this could easily be a local svn too:
svn mkdir https://source.sakaiproject.org/svn/msub/foo.edu/sam/
svn mkdir https://source.sakaiproject.org/svn/msub/foo.edu/sam/trunk
svn mkdir https://source.sakaiproject.org/svn/msub/foo.edu/sam/tags
svn mkdir https://source.sakaiproject.org/svn/msub/foo.edu/sam/branches
now into that project we need to copy certain parts of the SAM project:
svn copy https://source.sakaiproject.org/svn/sam/trunk/pom.xml https://source.sakaiproject.org/svn/msub/foo.edu/sam/trunk
svn copy https://source.sakaiproject.org/svn/sam/trunk/samigo-help https://source.sakaiproject.org/svn/msub/foo.edu/sam/trunk
svn copy https://source.sakaiproject.org/svn/sam/trunk/samigo-assembly https://source.sakaiproject.org/svn/msub/foo.edu/sam/trunk
Now that we have the project we need to do some quick edits to the poms:
1.in the base pom remove all the modules except samigo-help and samigo-assembly
2.edit the locations in the scm tags to point to the msub location
3.Update the distribution management location to point to your own local repository and change the ids of the servers to something institution specific*
4.change the groupIds from "org.sakaiproject.samigo" to "edu.foo.samigo"
5.change the version number to something that makes sense locally (remember to keep the -SNAPSHOT)
2 and 3 will allow us to release our artifacts using maven and 4 & 5 will enable us to easily distinguish our artifacts from the Sakai ones so we can be sure we deploy the right code to production later.
Now we are ready to make the meaningful changes. Firstly apply your changes to samigo-help. Now we need to edit the assembly to include our custom help jar rather than the sakai one. For backgroup you may want to have a look at Steve Swinberg's
blog post on assemblies. Firstly we need to fix the version for the samigo dependencies in samigo-assembly/pom.xml change ${project.version} to the version of samigo you want. Now change the dependency for samigo-help so that its group id is foo.edu.samigo and its version stays as ${project.version}. :Lastly we need to edit samigo-assembly/src/main/assembly/deploy.xml and change:
org.sakaiproject.samigo:samigo-help:jar:*
to
edu.foo.samigo:samigo-help:jar:*
Now we are basicaly done all thats left is to publish our artifacts to our repository. First though lets test . Run mvn clean install
In samigo-assembly/target/ you should now have a zip file with the tomcat overlay. If you open this with a zip application you should see your custom help jar in shared/lib/. Now lets publish our snapshot to the repository, making sure you have a server entry for your snapshot repository run:
mvn clean install deploy
This should push a snaphot artefact to your snaphot repository - you can check by browsing to edu/foo/samigo. Now lets cut a release so we have a stable artifact for our production build. This is a 2 stage process:
mvn release:prepare
Will cut a tag for you version.
mvn release:perform
will compile the binaries and publish them to the repository defined in the distribution management tag of the base pom.
* If you don't have a local maven repository you can set one up easily using something like nexus or simply apache or another webserver