So I have a small maven project in eclipse, if I export a runable JAR and select:
- Package required libaries into generated JAR
it works fine.
I should note that one of my JAR's is maven controlled (Univocity) the other is a local Oracle JDBC JAR. I want to include both of these in my runable JAR package so I can deploy a single JAR to production and execute it with a single command.
In my POM I added maven-assembly-plugin and when I use mvn package, I get a JAR with the Univocity library, but it skips the Oracle JAR.
How can I get it to bundle the Oracle JAR into the final output ?
Here is the POM:
<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>au.com.myco</groupId>
<artifactId>MyCoOracleExtractor</artifactId>
<version>0.0.4</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<univocity.version>2.0.0</univocity.version>
</properties>
<dependencies>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc6-11.2.0.4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>${univocity.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assembly:package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>au.com.myco.MyCoOracleExtractor</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I did try using maven-dependency-plugin, but it didnt solve the problem bundling them into the single JAR.