Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding DCM4CHE Library To Maven Project

I am new to Java and very new to Maven. I currently have my project configured with the quickstart archetype and have got the project to compile fine. I am running in to troubles trying to get the DCM4CHE libraries to work with this Maven project as I am not sure where they should go in the file structure as well as how they should be linked to my project ( I'm assuming as a dependency in my pom, but I can't find the right way to do it ). I have done a fair bit of Googling on the issue and can't seem to find anything useful, or that will work, on how to link them.

I am running Maven 3.3.9, Java 1.8.0.

My current pom.xml

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.srgmri.apps</groupId>
  <artifactId>hospital</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>hospital</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>9.3.9.M0</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>9.3.9.M0</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.38</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

and a link to the DCM4CHE libraries I am trying to import.

I am using Komodo IDE as my editor and am compiling using Maven on the command line.

My current file structure Current directory structure

Would really appreciate some guidance on how I can use these libraries in my main classes!

like image 296
Ben Ganley Avatar asked Apr 12 '16 02:04

Ben Ganley


1 Answers

Add repository to the pom:

<repositories>
<repository>
    <id>www.dcm4che.org</id>
    <name>dcm4che Repository</name>
    <url>http://www.dcm4che.org/maven2</url>
</repository>
</repositories>

Add dependency to the pom:

<dependency> 
    <groupId>dcm4che</groupId>
    <artifactId>dcm4che-core</artifactId>
    <version>2.0.29</version>
</dependency>

This has been discussed in How to import dcm4che library to java project?

like image 90
Pradeeban Kathiravelu Avatar answered Nov 19 '22 01:11

Pradeeban Kathiravelu