Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleSample maven settings.xml
linenumberstrue
collapsetrue
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <localRepository>${user.home}/.m2/repository</localRepository>
  <servers>
    <server>
      <username>{nexus_username}</username>
      <password>{nexus_password}</password>
      <id>openmrs-repo</id>
    </server>
    <server>
      <username>{nexus_username}</username>
      <password>{nexus_password}</password>
      <id>openmrs-repo-releases</id>
    </server>
    <server>
      <username>{nexus_username}</username>
      <password>{nexus_password}</password>
      <id>openmrs-repo-snapshots</id>
    </server>
    <server>
      <username>{nexus_username}</username>
      <password>{nexus_password}</password>
      <id>openmrs-repo-modules</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <properties>
        <archetypeRepository>http://mavenrepo.openmrs.org/nexus/content/repositories/public</archetypeRepository>
        <archetypeCatalog>http://mavenrepo.openmrs.org/nexus/content/repositories/public/archetype-catalog.xml</archetypeCatalog>
      </properties>
      <repositories>
        <repository>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </repository>
        <repository>
          <id>openmrs-repo-thirdparty</id>
          <name>OpenMRS Thirdparty Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/thirdparty</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>openmrs-repo</id>
          <name>OpenMRS Nexus Repository</name>
          <url>http://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
        </pluginRepository>
      </pluginRepositories>
      <id>openmrs</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>openmrs</activeProfile>
  </activeProfiles>
  <pluginGroups>
    <pluginGroup>org.openmrs.maven.plugins</pluginGroup>
  </pluginGroups>
</settings>

...

Code Block
languagexml
titleDistribution management in pom.xml
linenumberstruecollapsetrue
<distributionManagement>
		<repository>
			<id>openmrs-repo-modules</id>
			<name>OpenMRS Modules</name>
			<url>http://mavenrepo.openmrs.org/nexus/content/repositories/modules</url>
		</repository>
		<snapshotRepository>
			<id>openmrs-repo-snapshots</id>
			<name>OpenMRS Snapshots</name>
			<url>http://mavenrepo.openmrs.org/nexus/content/repositories/snapshots</url>
		</snapshotRepository>
	</distributionManagement>

...

Code Block
true
languagexml
titlemaven-settings.xml
firstline1
linenumberscollapsetrue
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd">
   <servers>
      <server>
         <id>openmrs-repo-snapshots</id>
         <username>${env.OPENMRS_REPO_USERNAME}</username>
         <password>${env.OPENMRS_REPO_PASSWORD}</password>
      </server>
   </servers>
</settings>
Code Block
languagetext
title.travis.yml
firstline1
linenumberstrue
collapsetrue
before_install: "git clone -b travis `git config --get remote.origin.url` target/travis"
after_script: "mvn deploy --settings target/travis/settings.xml"
language: java
branches:
  except:
    - travis
jdk:
 - openjdk7
 - oraclejdk7
script: mvn clean install --batch-mode
matrix:
  allow_failures:
   jdk: oraclejdk7
  env:
      global:

 


Add encrypted versions of the nexus username and password to the .travis.yml by executing the commands below at the root of your project

Code Block
languagebash
titleEncrypt Travis variables
linenumberstrue
travis encrypt OPENMRS_REPO_USERNAME=nexus_username --add env.global

...


travis encrypt OPENMRS_REPO_PASSWORD=nexus_username --add env.global

...

Info

NOTE: You need to encrypt the username and password for each repository, as the encrypted values are repository specific 

...