Maven : Ajouter des librairies locales à un jar exécutable
Bonjour,
J'ai un projet Java dans lequel j'ai des librairies situées dans un répertoire "lib".
Les librairies semblent avoir été renommées : je ne veux donc pas passer par Maven pour les télécharger.
Par contre, avec Maven, je voudrais faire un jar exécutable dans lequel les librairies sont présentes.
J'ai tenté de passer par "jar-with-dependencies" mais bien que le "jar-with-dependencies.jar" soit créé, il n'y a pas les lib dedans...
Je ne comprends pas pourquoi.
J'ai essayé de mettre la dépendance en scope system en renseignant le systemPath avec {chemin absolu}/lib/nomdetonfichier.jar mais ça n'a pas mieux marché.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| <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>com.mon.package</groupId>
<artifactId>MyProject01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MyProject01</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.objectweb.asm</groupId>
<artifactId>asm</artifactId>
<version>1.5.3</version>
<scope>system</scope>
<systemPath>C:/lib/asm.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
com.mon.package.maclasse
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> |
Avez-vous une idée de comment faire ?
Merci.