Maven Settings

The Geomark client Java API is available from the CITZ BC Government Maven repository. We recommend that all Java applications be developed using Maven with is the standard for CITZ applications. Developers are responsible for ensuring they know how to develop Java applications in maven. See Maven: The Complete Reference for details on developing with Maven.

The following code example shows how to include a dependency to the Geomark client API.

<?xml version="1.0" encoding="UTF-8"?>
<project
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"
>
  
  <dependencies>
    <dependency>
    <groupId>ca.bc.gov.geomark</groupId>
    <artifactId>geomark-client</artifactId>
    <version>${ca.bc.gov.geomark.version}</version>
    </dependency>
  </dependencies>
  
  <properties>
    <ca.bc.gov.geomark.version>6.0.6-RELEASE</ca.bc.gov.geomark.version>
  </properties>
</project>

Note that a property is used to define the Geomark version. In delivery the -SNAPSHOT suffix might be appended to the version to indicate that the most recent development snapshot is to be used. This is required if a new feature of the Geomark client API is required that has not yet been deployed to production. In test a .RC* suffix might be used for a release candidate.

Before migration to the production environment the dependency to the Geomark client must be updated to use the release version . This must be clearly documented in the application readme file. It is the developer's responsibility to ensure that the -SNAPSHOT or .RC* version is not used in production.

Include the following in the Perform Release of the README.txt for each version property. Replace the text VERSION with the version without the -SNAPSHOT or .RC* suffix.

Update property dependencies to latest RC or release version:
  ca.bc.gov.geomark.version: VERSION+

Include the following in the pom.xml for each version property. Replace the textVERSION with the version without the -SNAPSHOT or .RC* suffix.

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>1.3.1</version>
        <configuration>
          <properties>
            <property>
              <name>ca.bc.gov.geomark.version</name>
              <version>[VERSION,),[VERSION.RC,)</version>
            </property>
          </properties>
        </configuration>
      </plugin>
    </plugins>
  </build>

The BC Government deploy process uses the CodeHaus Versions Maven Plugin to update the -SNAPSHOT dependency to the production version.

mvn org.codehaus.mojo:versions-maven-plugin:2.0:use-releases -DgenerateBackupPoms=false

As the Geomark client is not deployed to the public maven repository your development environment must be configured to use the CITZ BC Govenment Maven repository. The following example Maven settings.xml adds two new profiles that include references to the CITZ BC Government Maven Repository. Copy the following file to ~/.m2/settings.xml (or merge if the file already exists) to enable Maven to download the libraries from these locations.

NOTE: To use the CITZ BC Government Maven Repository a VPN connection is required.

<?xml version="1.0" encoding="UTF-8"?>
<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
  "
>
  <profiles>
    <profile>
      <id>citz-artifactory</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>delivery.bcgov</id>
          <name>BC Government Repository</name>
          <url>https://delivery.apps.bcgov/artifactory/repo</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>