javamavenopenehr

How to install and use openEHR libraries with maven


I need to use these libraries https://github.com/openEHR/java-libs with netbeans and the installation guide tells to do:

REQUIREMENTS:

Java 1.6 or higher
Maven 3.0.4 or higher

INSTALATION INSTRUCTIONS:

INSTALLATION:

java-libs/mvn clean install

I meet the Java requirements and my NetBeans has bundled Maven 3.0.5, but I can't find a way to install and use the libraries in a Java project, could someone help me?


Solution

  • These instructions are for installing the java-libs artifact to your local maven artifacts repository, so it can be referenced by your project.

    Installing

    1. Actually, you'll first need to clone the java-libs repo to your machine.
    2. Then run mvn clean install inside the new directory created with the cloned repo.

    Using

    After you install the artifact, you can use it in your project by adding a dependency to your project's pom.xml file:

    <dependency>
      <groupId>openehr</groupId>
      <artifactId>ref_impl_java</artifactId>
      <version>1.0.11-SNAPSHOT</version>
    <dependency>
    

    How do I know the parameters above? By looking at the java-libs' pom.xml file.

    EDIT: As @Jack pointed, one should reference the specific library needed as dependency, like:

    <dependency>
      <groupId>openehr</groupId>
      <artifactId>archetype-validator</artifactId>
      <version>1.0.11-SNAPSHOT</version>
    <dependency>