Answer the question
In order to leave comments, you need to log in
How to properly build a project with maven dependencies?
Hello.
I decided to try using the maven builder to build a simple project with one single dependency
<dependencies>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.2</version>
</dependency>
</dependencies>
<?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>groupId</groupId>
<artifactId>SQLite_Client</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- Output to jar format -->
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.2</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<finalName>sqlite_client</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<goal>jar:inplace</goal>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
<!--<attachToBuild>true</attachToBuild>-->
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>Tests.SQLite_Client</mainClass>
</manifest>
<!--<manifestEntries>-->
<!--<Class-Path>teradataLibs/query-execution-service.jar teradataLibs/tdgssconfig.jar teradataLibs/terajdbc4.jar</Class-Path>-->
<!--</manifestEntries>-->
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Answer the question
In order to leave comments, you need to log in
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>my.package.Starter</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question