<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Add library with pom.xml</title><link>https://answers.axonivy.com/questions/2089/add-library-with-pom-xml</link><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I just tried to add a dependency by inserting the reference found here ( &lt;a href="https://mvnrepository.com/artifact/com.opencsv/opencsv/3.8)"&gt;https://mvnrepository.com/artifact/com.opencsv/opencsv/3.8)&lt;/a&gt; into the pom.xml of the project (using Axon Ivy Designer 6.0.4)&lt;/p&gt;
&lt;p&gt;I tried to build it with "mvn install" in the command line and got an error that the library is missing (CSVWriter cannot be resolved to a type)&lt;/p&gt;
&lt;p&gt;Executing the following command shows me that the artifact ist downloaded.&lt;/p&gt;
&lt;p&gt;"mvn dependency:get -Dartifact=com.opencsv:opencsv:3.8"&lt;/p&gt;
&lt;p&gt;&lt;code&gt;
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xapf_customer 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:get (default-cli) @ xapf_customer ---
[INFO] Resolving com.opencsv:opencsv:jar:3.8 with transitive dependencies
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.068 s
[INFO] Finished at: 2016-10-10T18:35:23+02:00
[INFO] Final Memory: 9M/22M
[INFO] ------------------------------------------------------------------------
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Adding the library in the Axon Ivy Environment removes the errors in the IDE. But the error still exits if I want to execute a "maven install". &lt;/p&gt;
&lt;p&gt;Is there anything I'm missing? &lt;/p&gt;
&lt;p&gt;BR and thx,
Gerald&lt;/p&gt;
&lt;p&gt;POM File:
&lt;code&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;project xsi:schemalocation="http://maven.apache.org/POM/4.0.0 &amp;amp;lt;a href=" http:="" maven.apache.org="" xsd="" maven-4.0.0.xsd""=""&amp;gt;http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;
  &amp;lt;modelversion&amp;gt;4.0.0&amp;lt;/modelversion&amp;gt;
  &amp;lt;groupid&amp;gt;xapf_customer_csv_export&amp;lt;/groupid&amp;gt;
  &amp;lt;artifactid&amp;gt;xapf_customer_csv_export&amp;lt;/artifactid&amp;gt;
  &amp;lt;version&amp;gt;1.0.0-SNAPSHOT&amp;lt;/version&amp;gt;
  &amp;lt;packaging&amp;gt;iar&amp;lt;/packaging&amp;gt;
  &amp;lt;description&amp;gt;Based on Template Version 1.1.0&amp;lt;/description&amp;gt;
  &amp;lt;dependencies&amp;gt;
    &amp;lt;dependency&amp;gt;
      &amp;lt;groupid&amp;gt;xapf_persistence&amp;lt;/groupid&amp;gt;
      &amp;lt;artifactid&amp;gt;xapf_persistence&amp;lt;/artifactid&amp;gt;
      &amp;lt;version&amp;gt;[1.0.0-SNAPSHOT,)&amp;lt;/version&amp;gt;
      &amp;lt;type&amp;gt;iar&amp;lt;/type&amp;gt;
    &amp;lt;/dependency&amp;gt;
    &amp;lt;dependency&amp;gt;
      &amp;lt;groupid&amp;gt;ch.soreco.xapf.engine&amp;lt;/groupid&amp;gt;
      &amp;lt;artifactid&amp;gt;ch.soreco.xapf.engine&amp;lt;/artifactid&amp;gt;
      &amp;lt;version&amp;gt;[3.0.0-SNAPSHOT,)&amp;lt;/version&amp;gt;
      &amp;lt;type&amp;gt;iar&amp;lt;/type&amp;gt;
    &amp;lt;/dependency&amp;gt;
    &amp;lt;dependency&amp;gt;
      &amp;lt;groupid&amp;gt;ch.soreco.xapf.masterdata&amp;lt;/groupid&amp;gt;
      &amp;lt;artifactid&amp;gt;ch.soreco.xapf.masterdata&amp;lt;/artifactid&amp;gt;
      &amp;lt;version&amp;gt;[3.0.0-SNAPSHOT,)&amp;lt;/version&amp;gt;
      &amp;lt;type&amp;gt;iar&amp;lt;/type&amp;gt;
    &amp;lt;/dependency&amp;gt;
    &amp;lt;dependency&amp;gt;
      &amp;lt;groupid&amp;gt;xapf_archive_d3&amp;lt;/groupid&amp;gt;
      &amp;lt;artifactid&amp;gt;xapf_archive_d3&amp;lt;/artifactid&amp;gt;
      &amp;lt;version&amp;gt;[1.0.0-SNAPSHOT,)&amp;lt;/version&amp;gt;
      &amp;lt;type&amp;gt;iar&amp;lt;/type&amp;gt;
    &amp;lt;/dependency&amp;gt;
    &amp;lt;dependency&amp;gt;
        &amp;lt;groupid&amp;gt;com.opencsv&amp;lt;/groupid&amp;gt;
        &amp;lt;artifactid&amp;gt;opencsv&amp;lt;/artifactid&amp;gt;
        &amp;lt;scope&amp;gt;compile&amp;lt;/scope&amp;gt;
        &amp;lt;type&amp;gt;jar&amp;lt;/type&amp;gt;
        &amp;lt;version&amp;gt;3.8&amp;lt;/version&amp;gt;
    &amp;lt;/dependency&amp;gt;
  &amp;lt;/dependencies&amp;gt;
  &amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupid&amp;gt;com.axonivy.ivy.ci&amp;lt;/groupid&amp;gt;
        &amp;lt;artifactid&amp;gt;project-build-plugin&amp;lt;/artifactid&amp;gt;
        &amp;lt;version&amp;gt;6.0.0&amp;lt;/version&amp;gt;
        &amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;
      &amp;lt;/plugin&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupid&amp;gt;org.apache.maven.plugins&amp;lt;/groupid&amp;gt;
        &amp;lt;artifactid&amp;gt;maven-jar-plugin&amp;lt;/artifactid&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
  &amp;lt;/build&amp;gt;
&amp;lt;/project&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;code&gt;
&lt;/code&gt;&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2089/add-library-with-pom-xml" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 19 Sep 2017 11:45:18 -0400</lastBuildDate><item><title>Answer by adamf</title><link>https://answers.axonivy.com/questions/2089/add-library-with-pom-xml/2871</link><description>&lt;p&gt;Another way to use maven-dependency-plugin suggestested by Emmanuel is this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;plugin&amp;gt;
    &amp;lt;artifactId&amp;gt;maven-dependency-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;Copy-dependency-PROD&amp;lt;/id&amp;gt;
            &amp;lt;phase&amp;gt;validate&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;copy-dependencies&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
            &amp;lt;configuration combine.self="override"&amp;gt;
            &amp;lt;outputDirectory&amp;gt;${basedir}/lib&amp;lt;/outputDirectory&amp;gt;
            &amp;lt;stripVersion&amp;gt;true&amp;lt;/stripVersion&amp;gt;
            &amp;lt;includeScope&amp;gt;compile&amp;lt;/includeScope&amp;gt;
            &amp;lt;excludeGroupIds&amp;gt;org.powermock, org.hamcrest,org.mockito, junit, org.objenesis, org.sonarsource.java&amp;lt;/excludeGroupIds&amp;gt;
            &amp;lt;excludeArtifactIds&amp;gt;jsf-api, javase, commons-codec&amp;lt;/excludeArtifactIds&amp;gt;
            &amp;lt;excludeTypes&amp;gt;iar&amp;lt;/excludeTypes&amp;gt;
            &amp;lt;excludeTransitive&amp;gt;true&amp;lt;/excludeTransitive&amp;gt;
            &amp;lt;/configuration&amp;gt;
        &amp;lt;/execution&amp;gt;
    &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will include any jar dependency to the lib directory and is packged when running maven. In Desinger it still needs to be linked manually once by right clicking on the project, "Build Path.." -&amp;gt; Configure Build Path -&amp;gt; Add External JARs.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">adamf</dc:creator><pubDate>Tue, 19 Sep 2017 11:45:18 -0400</pubDate><guid>https://answers.axonivy.com/questions/2089/add-library-with-pom-xml/2871</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/2089/add-library-with-pom-xml/2094</link><description>&lt;p&gt;The thing is, that only IAR maven-dependencies are included in the projects classpath on the engine. There is currently no built in support to include normal JAR dependencies in a project and auto-download them when a project is deployed to an engine.&lt;/p&gt;
&lt;p&gt;A simple work-around is to add the maven-dependency-copy plugin to your POM.xml. It will copy JAR dependencies to a directory in your project and you can add it to the classapth: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;build&amp;gt;
&amp;lt;plugins&amp;gt;
...
    &amp;lt;plugin&amp;gt;
        &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;maven-dependency-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;2.10&amp;lt;/version&amp;gt;
        &amp;lt;executions&amp;gt;
            &amp;lt;execution&amp;gt;
                &amp;lt;id&amp;gt;copy.maven.dependencies&amp;lt;/id&amp;gt;
                &amp;lt;goals&amp;gt;&amp;lt;goal&amp;gt;copy&amp;lt;/goal&amp;gt;&amp;lt;/goals&amp;gt;
                &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;
                &amp;lt;configuration&amp;gt;
                    &amp;lt;outputDirectory&amp;gt;lib&amp;lt;/outputDirectory&amp;gt;
                    &amp;lt;artifactItems&amp;gt;
                        &amp;lt;artifactItem&amp;gt;
                            &amp;lt;groupId&amp;gt;com.opencsv&amp;lt;/groupId&amp;gt;
                            &amp;lt;artifactId&amp;gt;opencsv&amp;lt;/artifactId&amp;gt;
                            &amp;lt;version&amp;gt;3.8&amp;lt;/version&amp;gt;
                        &amp;lt;/artifactItem&amp;gt;
                    &amp;lt;/artifactItems&amp;gt;
                &amp;lt;/configuration&amp;gt;
            &amp;lt;/execution&amp;gt;
        &amp;lt;/executions&amp;gt;
    &amp;lt;/plugin&amp;gt;
&amp;lt;/plugins&amp;gt;
&amp;lt;/build&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this configuration you can run &lt;code&gt;mvn clean generate-resources&lt;/code&gt;, refresh your project in the workspace afterwards and add the JARs in the lib directory to your classpath via: Java Perspective -&amp;gt; Right click on Jar -&amp;gt; build path -&amp;gt; add to build path&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 11 Oct 2016 09:04:14 -0400</pubDate><guid>https://answers.axonivy.com/questions/2089/add-library-with-pom-xml/2094</guid></item></channel></rss>