JAR File and External Dependency in POM

Dear all,

I’ve got one jar file how can I embed this into DHIS2 resource with using dependency in pom.xml ?
Anyway, If I have got a few of classes. So how can I make an external dependency in pom.xml file ?

Can someone show me that way in step by step ?

Thank you all so much !

···


Hieu.HISPVietnam
Good Health !

Hi Hieu,

you can either

BUT we really try to avoid using JAR dependencies which are not in the Maven repository. What JAR file are we talking about here?

Lars

···

On Mon, Dec 21, 2009 at 11:36 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Dear all,

I’ve got one jar file how can I embed this into DHIS2 resource with using dependency in pom.xml ?
Anyway, If I have got a few of classes. So how can I make an external dependency in pom.xml file ?

Can someone show me that way in step by step ?

Thank you all so much !


Hieu.HISPVietnam
Good Health !

There are a few ways to do it, although I would avoid putting more libraries into trunk without a lot of contemplation

Anyways, the steps follow (using the normal Java pattern of things, don’t know if DHIS2 follows a different style) :

1.) Place the lib jar into: /src/main/webapp/WEB-INF/lib/mylib.jar

2.) add the dependency (mylib.jar) into pom.xml as follows:

mylib

mylib

0.1.0

system

${basedir}/src/main/webapp/WEB-INF/lib/mylib-0.1.0.jar

Hope that helps

···

Regards,
Saptarshi PURKAYASTHA
Director R & D, HISP India
Health Information Systems Programme

My Tech Blog: http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE

2009/12/21 Hieu Dang Duy hieu.hispvietnam@gmail.com

Dear all,

I’ve got one jar file how can I embed this into DHIS2 resource with using dependency in pom.xml ?
Anyway, If I have got a few of classes. So how can I make an external dependency in pom.xml file ?

Can someone show me that way in step by step ?

Thank you all so much !


Hieu.HISPVietnam
Good Health !


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

The suggestions by both Lars and Saptarshi might help … but why you wanted to do it through jar?

You said you only have few classes, so my suggestion would be - to put then in either support-system or options. In fact we could suggest a better location if you could tell us what these classes are doing?

Thank you,
Abyot.

···

On Mon, Dec 21, 2009 at 11:55 AM, Saptarshi Purkayastha sunbiz@gmail.com wrote:

There are a few ways to do it, although I would avoid putting more libraries into trunk without a lot of contemplation

Anyways, the steps follow (using the normal Java pattern of things, don’t know if DHIS2 follows a different style) :

1.) Place the lib jar into: /src/main/webapp/WEB-INF/lib/mylib.jar

2.) add the dependency (mylib.jar) into pom.xml as follows:

mylib

mylib

0.1.0

system

${basedir}/src/main/webapp/WEB-INF/lib/mylib-0.1.0.jar

Hope that helps


Regards,
Saptarshi PURKAYASTHA
Director R & D, HISP India
Health Information Systems Programme

My Tech Blog: http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE

2009/12/21 Hieu Dang Duy hieu.hispvietnam@gmail.com

Dear all,

I’ve got one jar file how can I embed this into DHIS2 resource with using dependency in pom.xml ?
Anyway, If I have got a few of classes. So how can I make an external dependency in pom.xml file ?

Can someone show me that way in step by step ?

Thank you all so much !


Hieu.HISPVietnam
Good Health !


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Lars,

Thanks for replying sooner mail.

You can see the example as below:

This is the dependency in Excel Reporting module:

***
org.apache.poi

    <artifactId>poi-ooxml</artifactId>       
    <version>3.5-FINAL</version>

***

Yup, maybe you have been seen this dependency before. If we use maven to build this so after downloaded the package as poi-ooxml***-3.5-FINAL*****.jar** Maven will automatically download another package is that ooxml-schemas-1.0.jar with over **14MB

**Because poi-ooxml-3.5-FINAL has got a pom file with structure like this:

 **<dependencies>
    <dependency>
       <groupId>org.apache.poi</groupId>

       <artifactId>poi</artifactId>
       <version>3.5-FINAL</version>
    </dependency>

    <dependency>
      <groupId>org.apache.poi</groupId>

      <artifactId>ooxml-schemas</artifactId>

      <version>1.0</version>

    </dependency>
    <dependency>
        <groupId>dom4j</groupId>

        <artifactId></artifactId>
        <version>1.6.1</version>
    </dependency>

  </dependencies>**

You can see the highlight dependency as above.

Thanks !

···

On Mon, Dec 21, 2009 at 5:45 PM, Lars Helge Øverland larshelge@gmail.com wrote:

On Mon, Dec 21, 2009 at 11:36 AM, Hieu Dang Duy hieu.hispvietnam@gmail.com wrote:

Dear all,

I’ve got one jar file how can I embed this into DHIS2 resource with using dependency in pom.xml ?
Anyway, If I have got a few of classes. So how can I make an external dependency in pom.xml file ?

Can someone show me that way in step by step ?

Thank you all so much !


Hieu.HISPVietnam
Good Health !

Hi Hieu,

you can either

BUT we really try to avoid using JAR dependencies which are not in the Maven repository. What JAR file are we talking about here?

Lars


Hieu.HISPVietnam
Good Health !

OK in that case you can use the “exlusion” element:

<dependency>
      <groupId>group-a</groupId>
      <artifactId>artifact-a</artifactId>
      <version>1.0</version>

      <exclusions>
        <exclusion>
          <groupId>group-c</groupId>
          <artifactId>excluded-artifact</artifactId>
        </exclusion>
      </exclusions>

    </dependency>

But I am not sure if this is a good practise, you need to make sure it is safe and meaningful to exclude that dependency…

Yeas,

Thank you Lars and everyone !

···

On Mon, Dec 21, 2009 at 6:07 PM, Lars Helge Øverland larshelge@gmail.com wrote:

OK in that case you can use the “exlusion” element:

<dependency>

      <groupId>group-a</groupId>
      <artifactId>artifact-a</artifactId>
      <version>1.0</version>

      <exclusions>
        <exclusion>
          <groupId>group-c</groupId>
          <artifactId>excluded-artifact</artifactId>
        </exclusion>
      </exclusions>


    </dependency>

But I am not sure if this is a good practise, you need to make sure it is safe and meaningful to exclude that dependency…


Hieu.HISPVietnam
Good Health !