Deploying Maven Artifacts

CollectionSpace hosts an Apache Maven repository on Amazon S3. This repository contains compiled CollectionSpace components, as well as some third party libraries. Deploying artifacts to the Maven repository happens rarely, and only when:

  • A new version of CollectionSpace is released. Release versions of compiled CollectionSpace components are deployed. (Note: It’s uncertain if anyone is using CollectionSpace components to build their own applications, so this may not be needed.)

  • A new snapshot of the upcoming CollectionSpace release is needed. (Note: It’s uncertain if anyone is using CollectionSpace components to build their own applications, so this may actually never be needed.)

  • CollectionSpace’s Nuxeo dependencies are upgraded to a newer version. The latest hotfix release of the targeted version is compiled from source, and the resulting artifacts are deployed.

  • A third-party library used by CollectionSpace becomes unavailable. This may happen if the artifact is hosted on a project’s own Maven repository, and that project becomes unsupported; access to that repository may be terminated. In this case, a copy of the artifact may be uploaded to CollectionSpace’s repository, so that builds may continue while an alternative library is found.

Set Up

Deploying to the CollectionSpace Maven repository requires write access to the cspace-maven-repo S3 bucket. If you need this access, ask a CollectionSpace developer for instructions, or email talk@lists.collectionspace.org.

To continue, you will need the access key and secret of an appropriate AWS user.

Create (or edit) the .m2/settings.xml file in your home directory. Enter a server configuration, as in the following example:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>cspace</id> <username>{key}</username> <password>{secret}</password> <configuration> <region>us-west-2</region> </configuration> </server> </servers> </settings>

Note that the id must be cspace, because this corresponds to the id found in pom.xml files in CollectionSpace source code.

The username should be your AWS access key, and the password should be your secret. The region must be us-west-2, since this is where the S3 bucket resides.

Deploying CollectionSpace Components

To compile and deploy CollectionSpace services components, use the following command in the services source directory:

mvn clean deploy -DskipTests

If the version of the project (defined in pom.xml) contains -SNAPSHOT, the resulting artifacts will be deployed to the libs-snapshot-local folder in the cspace-maven-repobucket. Otherwise, they will be deployed to the libs-release-local folder.

Deploying Nuxeo Components

TODO: Need to update these instructions: https://collectionspace.atlassian.net/wiki/spaces/collectionspace/pages/666272662/Deploy+Nuxeo+Artifacts+jars+to+CSpace+s+Artifactory+Repository

Deploying Third-Party Libraries

To deploy third-party libraries, locate a .jar file and a pom.xml file for the library. These may exist in your local Maven repository, in the .m2/repository directory in your home directory. If they are in your local repository, copy the files out before continuing. Files may not be deployed directly from the local repository.

Use the following command in the services source directory:

mvn deploy:deploy-file \ -Durl=s3://cspace-maven-repo/libs-release-local \ -DrepositoryId=cspace \ -Dfile={path_to_jar_file} \ -DpomFile={path_to_pom_file}

Replace {path_to_jar_file} with the location of the .jar file you want to deploy, and {path_to_pom_file}with the location of the pom.xml file. If the version of the library is a snapshot (the filename contains -SNAPSHOT), replace libs-release-local with libs-snapshot-local in the url.

Â