Questions tagged [maven-jar-plugin]

This plugin provides the capability to build and sign jars.

The Maven Jar Plugin provides the capability to build and sign jars. This is one of the most common plugins used in Maven.

If the packaging of your project is set to jar, this plugin is executed whenever it passes the package phase, according to default Maven bindings.

Goals Overview

From the official documentation :

  • jar:jar create a jar file for your project sources.
  • jar:test-jar create a jar file for your project test classes.

Check the official usage page for a first look at this plugin.

171 questions
158
votes
15 answers

Maven: The packaging for this project did not assign a file to the build artifact

I'm using Maven 3.0.3 on Mac 10.6.6. I have a JAR project and when I run the command "mvn clean install:install", I'm getting the error, [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-cli) on…
Dave
  • 8,667
  • 25
  • 72
  • 90
102
votes
11 answers

m2e error in MavenArchiver.getManifest()

I am seeing an error in my STS and am not sure how to debug it. Searching around I only see vague references to the error and no solutions. The error is: org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject,…
scottmf
  • 1,506
  • 2
  • 14
  • 16
51
votes
6 answers

Maven JAR Plugin 3.0.2 Error: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them

Maven JAR plugin (version 3.0.2) keeps throwing the following error, even for a single invocation of the jar goal: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar (default) on project test: You have to use a…
Alex Shesterov
  • 26,085
  • 12
  • 82
  • 103
40
votes
1 answer

How can I include test classes into Maven jar and execute them?

In a Maven project, I have test classes and source classes in the same package, but in different physical locations. .../src/main/java/package/** <-- application code .../src/test/java/package/** <-- test code It's no problem to access the source…
jam
  • 1,253
  • 1
  • 12
  • 26
34
votes
2 answers

How to include test classes in Jar created by maven-shade-plugin?

I'm trying to package my test classes in to an executable jar with dependencies using Maven, but I'm struggling to get this right. This is my pom.xml so far: 4.0.0 com.c0deattack
C0deAttack
  • 24,419
  • 18
  • 73
  • 81
23
votes
2 answers

Disable the default-jar execution

I am using Maven Assembly plugin to pack a jar file. But when I run mvn package, maven always trigger the [jar:jar {execution: default-jar}] to create a default jar file. So I will have 2 jar files (one created by Assembly plugin and one created by…
David
  • 3,538
  • 9
  • 39
  • 50
18
votes
11 answers

Maven failed to execute goal org.apache.maven.plugins:maven-jar-plugin

Like below, I had an error when running mvn package [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project hello-world: Execution default-jar of goal…
verystrongjoe
  • 3,831
  • 9
  • 35
  • 66
17
votes
2 answers

How to use Maven assembly plugin with multi module maven project

I am new to maven and spent ~3 days in generating the zip file with assembly plugin refering to http://www.petrikainulainen.net/programming/tips-and-tricks/creating-a-runnable-binary-distribution-with-maven-assembly-plugin/ My project is multi…
kashili kashili
  • 955
  • 4
  • 15
  • 31
14
votes
2 answers

JDK9 and maven-jar-plugin

I just upgraded my Java8 project with the brand new official release of Java9. The project uses a Maven plugin, org.apache.maven.plugins:maven-jar-plugin version 2.6. When I run mvn clean install I now get the following exception: ERROR] Failed to…
JeanValjean
  • 17,172
  • 23
  • 113
  • 157
13
votes
4 answers

Maven: include files in JAR's META-INF

I'm using Maven to build a Java project, and I've got a couple files, CHANGELOG and LICENSE, that I'd like to copy to the META-INF directory inside the JAR file. So far what I've got working is the following:
Julián Urbano
  • 8,378
  • 1
  • 30
  • 52
12
votes
2 answers

Maven : add external resources

I am building an executable jar file with maven, meaning that you run it with "java -jar file.jar". I want to rely on user defined properties (just a file containing keys/values), during developpement phase I was putting my "user.properties" file in…
11
votes
10 answers

UnsupportedClassVersionError: has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version (..)up to 52.0

I'm trying to launch the jar file I've builded for my Spring Boot project. First I did: mvn clean package spring-boot:repackage then I've tried to launch the jar file, and I had the following error: Exception in thread "main"…
Usr
  • 2,628
  • 10
  • 51
  • 91
11
votes
1 answer

Why is the Maven JAR plugin not including some resources?

I have an enterprise application which I am in the process of converting from an Ant build to Maven. It's almost completely converted; this is the very last thing I need to fix. The application is packaged as an EAR file which contains two WARs…
JakeRobb
  • 1,711
  • 1
  • 17
  • 32
10
votes
3 answers

Maven does not generate a MANIFEST file with maven jar plugin

I try to generate a .zip file with maven (mvn package) and want to have a MANIFEST file in the zip too. The jar file itself does work. I tried to generate a MANIFEST file with maven jar plugin, but it did not work. Do I Have to do something else to…
Lua Mia
  • 103
  • 1
  • 1
  • 6
10
votes
3 answers

How to set additional Class-Path entries in manifest with onejar Maven plugin?

Is there a way to add an arbitrary classpath entry to a JAR file manifest using onejar-maven-plugin? I found the way to configure maven-jar-plugin to do this, but it appears that there is no such option for onejar-maven-plugin. This is not done to…
Gene M
  • 1,136
  • 1
  • 10
  • 16
1
2 3
11 12