Total Pageviews

2018/01/07

[Maven] Cannot find IBM-related jar files in Maven Central Repository

Problem
If I would like to use some proprietorial jar files (i.e. IBM DB2 jdbc jar file, IBM MessageQueue jar files) in my Maven project, and add them into dependency. 
How to do it?

How-To

Step 1. Download jar files, ex. DB2 jdbc jar file
Step 2. Launch command prompt, change directorty to db2 jar file and execute the following command:
mvn install:install-file -Dfile=db2jcc4-4.22.29.jar -DgroupId="com.ibm.db2.jcc" -DartifactId="db2jcc4" -Dversion="4.22.29" -Dpackaging="jar"

Step 3. Add dependency to pom.xml
    <dependency>
        <groupId>com.ibm.db2.jcc</groupId>
        <artifactId>db2jcc4</artifactId>
        <version>4.22.29</version>
    </dependency>


Step 4. Go to .m2 folder and copy com/ibm/db2/jcc/db2jcc4 to your project, for example:


Step 5. Add repository setting in your pom.xml
    <repositories>
        <repository>
            <id>my-local-repo</id>
            <!-- ${basedir} represents the directory containing pom.xml -->
            <url>file://${basedir}/local-repo</url> 
        </repository>
    </repositories>




No comments: