Question Details

No question body available.

Tags

java maven intellij-idea

Answers (1)

June 17, 2026 Score: 2 Rep: 51,421 Quality: Medium Completeness: 100%

Typo in POM

As I commented in the staging ground, this error is not from your code. The exception is being thrown by Maven and it's caused by a typo in your POM. You have manifestentries but the actual element name is manifestEntries. Note the camel case; elements and attributes in the Maven POM are case-sensitive.

Defining Class-Path Entry

That said, you are defining the Class-Path manifest entry "wrong". You don't have to do it manually. Which means you don't need the manifestEntries element at all. The following will work for you:

true lib gestionBar.Controller.Controller.Controller

I set the class-path prefix to lib because that's what you seem to be trying to do in your current POM. Note this means your project's dependency JAR files will have to be in a directory named lib relative to your executable JAR file. If you want a different directory name then change the class-path prefix. If you want the dependency JAR files to be next to your executable JAR file then don't set the class-path prefix.

See https://maven.apache.org/shared/maven-archiver/index.html for more information.

Deployment

You responded to me in the staging ground saying that after fixing your POM you get the following error:

$ java -jar ProjetJava-1.0-SNAPSHOT.jar 
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager 
    at gestionBar.Controller.Controller.Controller.(Controller.java:20)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:502)
    ... 1 more

That's a different error. As noted earlier, you need to deploy your dependencies' JAR files alongside your executable JAR file. With the class-path prefix of lib they specifically need to be in a lib directory relative to said executable JAR file.

The easiest way to get the JAR files of your dependencies in a Maven project is via the copy-dependencies goal of the Maven Dependency Plugin. That goal will copy dependencies into an output directory. By default, that directory is ${project.build.directory}/dependency.

Here's an example POM based on your POM that:

  • Changes the project JAR's output directory to a directory named after the project's name: ${project.build.outputDirectory}/${project.name}.

  • Uses dependency:copy-dependencies to copy the dependency JAR files into a directory named lib relative to the directory mentioned in the first point. This goal is configured to run during the package phase.

Which makes it easy to copy your application JAR files to another location, as you just have to copy the ${project.name} (ProjectJava in your POM) directory (may want to ZIP the directory for transport, depending on where you're deploying to).

4.0.0

org.example ProjetJava 1.0-SNAPSHOT jar

ProjetJava http://maven.apache.org

UTF-8

${project.build.outputDirectory}/${project.name}

junit junit 3.8.1 test

org.apache.logging.log4j log4j-api 2.26.0

org.apache.logging.log4j log4j-core 2.26.0 compile

org.apache.maven.plugins maven-compiler-plugin

21 21

org.apache.maven.plugins maven-jar-plugin

${appOutputDir}

true lib gestionBar.Controller.Controller.Controller

org.apache.maven.plugins maven-dependency-plugin

copy-dependencies package

copy-dependencies

${appOutputDir}/lib

Note I did not test the above POM. Let me know if there are errors and I can fix them.

Running Application from Maven

As an aside, if all you want to do is execute your application from Maven during development then check out Exec Maven Plugin.

Some Extra Notes

To address a few other things not directly related to your problem:

  • The should be a URL to a webpage about your project, not a URL to Maven's website. For open-source project's that will often be a URL to your project's source repository (e.g., on GitHub, GitLab, etc.). More "mature" projects typically have a dedicated website (possibly hosted by GitHub/GitLab/etc.).

  • JUnit 3 is extremely outdated. If this is a new project, which it seems to be, then I strongly recommend using JUnit 6.

  • This is an odd main class name: gestionBar.Controller.Controller.Controller. It's odd for a few reasons:

    • Standard naming conventions in Java have package names all lowercase.

    • Having a nested package named the same as its "parent" package is atypical.

    • Controller is a slightly odd name for a main class, but that's not really a big deal.