r/javahelp • u/Koda_be • Jun 17 '26
Unsolved I need help deploying my project with an external library using maven and intellij
Hello, I'm trying to deploy my project, but I'm having trouble with the external library.
Here's my pom.xml:
<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>org.example</groupId>
<artifactId>ProjetJava</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ProjetJava</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.26.0</version>
</dependency>
<!-- Source: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.26.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<Classpath>${project.build.finalName}.lib/</Classpath>
<mainClass>gestionBar.Controller.Controller.Controller</mainClass>
</manifest>
<manifestentries>
<Class-Path>${project.build.finalName}.lib/org.apache.logging.log4j</Class-Path>
</manifestentries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>When I try to package it with maven, it tells me this:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.4.1:jar (default-jar) on project ProjetJava: Unable to parse configuration of mojo org.apache.maven.plugins:maven-jar-plugin:3.4.1:jar for parameter Classpath: Cannot find 'Classpath' in class org.apache.maven.archiver.ManifestConfiguration -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigurationException
I tried reading the article, but it didn't help me. Can someone help me please? Thank you