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
3
votes
2 answers

Maven project packaging is war but also building/installing jar

I have a Maven 3.3 project, and the main output is a war file: pro 1.0-SNAPSHOT war I am using the maven plugin to also build a jar file, which goes into target/pro-1.0-SNAPSHOT.jar…
mikeb
  • 10,578
  • 7
  • 62
  • 120
3
votes
2 answers

maven assembly plugin: add a file into a dependency jar

There is this maven module, say prj-package-module, to package the project artifacts into a tar file using maven-assembly-plugin. There are also jars added as dependencies in the prj-package-module/pom.xml and packaged into the tar file. Now the…
Kiran Mohan
  • 2,696
  • 6
  • 36
  • 62
3
votes
0 answers

Maven: build jar containing specific classes from other sibling modules

I have the need to build a jar file, which contains a selection of individual class files from other sibling maven modules. I've tried using the maven-assembly and the maven-jar-plugin's, but can't seem to come up with a working pom/config. Could…
Ben
  • 6,567
  • 10
  • 42
  • 64
3
votes
1 answer

Best practice for packaging resource files and classes with Maven

Currently I have a sample maven project with the following build part where I specify a second resource location directory: ... src/main/second-resources
tmarwen
  • 15,750
  • 5
  • 43
  • 62
3
votes
1 answer

java -jar is not able to read classpath from manifest file resulting in NoClassDefFoundError error

My MANIFEST.MF file looks like this My main() prints the classpath - ClassLoader cl = ClassLoader.getSystemClassLoader(); URL[] urls = ((URLClassLoader)cl).getURLs(); for(URL url: urls){ …
user375868
  • 1,288
  • 4
  • 21
  • 45
2
votes
1 answer

How to keep manifest and exclude POM from JAR?

Found that I can exclude pom.xml from final jar using: true But this exclude the xml and the pom.properties is there a way to keep only pom.properties? thx
code-gijoe
  • 6,949
  • 14
  • 67
  • 103
2
votes
4 answers

multi artifact id in one pom

There is a maven project(jar), but now it needs to be spilt into two artifacts I want to have two maven artifact like following xxx xxx-client xxx xxx-impl But all…
jilen
  • 5,633
  • 3
  • 35
  • 84
2
votes
2 answers

Different MANIFEST.MF for default jar-file and tests.jar

I'm trying to create different MANIFEST.MF files for the jar-packaged artifacts and the test-jar-packaged. The maven-jar-plugin being used to add additional stuff into the MANIFEST.MF - that works perfectly so far. But if I'd like to chose different…
polemoser
  • 59
  • 6
2
votes
1 answer

A required class was missing while executing org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar

When I run mvn clean install on my maven project, It is giving me the below error [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ commons --- [DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=6375, ConflictMarker.markTime=11066,…
Abdul Mohsin
  • 1,253
  • 1
  • 13
  • 24
2
votes
0 answers

Skip default jar creation in maven causes error

Im using maven 3.8.3. Tryig to avoid the step of the default jar creation, using the answers I found in topics like: remove jar created by default in maven What is the best way to avoid maven-jar? What I tried: 1.
Paz
  • 61
  • 3
2
votes
2 answers

How to package an Ant project with Maven?

In the project I'm working on, there's a extenal dependency that's not avaliable on the public Maven artifact index, but there's a public repository with the project code. The project is natively built using ant. What we are planning to do is to…
2
votes
0 answers

Spring Boot run - No manifest.mf

I use Spring Boot (2.1.1.RELEASE) with Maven (3.6.0). My MANIFEST.MF is generated by maven-jar-plugin. This works fine if I run mvn clean install. I need to read and parse the manifest at runtime and that works fine if I run the the build JAR from…
Henok
  • 413
  • 2
  • 7
  • 20
2
votes
1 answer

"Deleting" the generated default jar in Maven

There are solutions available to "disable" the default jar that is generated by the maven-jar-plugin. However, since my final artifacts probably depend on this jar (I am relatively new to maven, so not entirely sure if it is actually the case, but…
2
votes
1 answer

Maven: Simple classpathLayoutType is generating classpath similar to repository classpathLayoutType

I have a maven project which does the following: Generates the jar and copies it into target/dist directory. Copies all dependency jars into target/dist/lib directory. Distributes the dist folder. Requires the dependency jars to be executed in the…
Nagabhushan S N
  • 6,407
  • 8
  • 44
  • 87
2
votes
3 answers

How to import import org.apache.poi.ss.usermodel.Row error?

I am tring to write data into Excel using Apache i refer this link:https://www.mkyong.com/java/apache-poi-reading-and-writing-excel-file-in-java/ Cell and Row are not Importing This my java class code: I download Apache jar file here MY java code…
demo
  • 672
  • 3
  • 9
  • 34