Intellij - Maven library issue

Answered

Hi Everyone,

I'm quite new in Java and I'm struggling to create a JAR file with maven.

The file is created but I got each time an error "org.sqlite.JDBC". It seems the library is not "in the jar file".

This is my pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<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>HJAV</groupId>
<artifactId>ModLogProject</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.21.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>

<resources>
<!-- regular resource processsing for everything except logback.xml -->
<resource>
<directory>src/main/resources/database</directory>
<excludes>
<exclude>sncb.sqlite</exclude>
</excludes>
</resource>
<!-- resource processsing with a different output directory
for logback.xml -->
<resource>
<directory>src/main/resources/database</directory>
<includes>
<include>sncb.sqlite</include>
</includes>
<!-- relative to target/classes
i.e. ${project.build.outputDirectory} -->
<targetPath>..</targetPath>
</resource>
</resources>
</build>

</project>

 

 

 

 

Thanks a lot for your help !!

 

Hervé

 

0
1 comment

Please google for "Maven fat jar".

It's not specific to IntelliJ IDEA, so this forum is not the best place for such questions.

0

Please sign in to leave a comment.