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
1
vote
1 answer

Rename profile activated dependency when building executable JAR

I am fairly new to working with Maven to build my Java projects, and have run into a situation I don't know how to handle. I have a Java application that has 3 dependencies, let's call them a, b, and c. However, c will be a different artifact…
Sean Bright
  • 118,630
  • 17
  • 138
  • 146
1
vote
1 answer

maven-jar-plugin file filterring

I have a some perl file in my src/main/java/com/pac/report.pl which I want to package as part of my classes in the jar file. Using maven maven-jar-plugin include directives, I have tried below and various other suggestions I pulled off the web, but…
Bitmap
  • 12,402
  • 16
  • 64
  • 91
1
vote
3 answers

How to configure maven jar plugin to exclude properties on profile

I have this configuration in my pom org.apache.maven.plugins maven-jar-plugin 2.2
Massimo Ugues
  • 4,373
  • 8
  • 43
  • 56
0
votes
3 answers

How am I supposed to choose the location of config files in maven project

I am building a command line tool which relies on some configuration files. On development, I put those files under src/main/resources, and accessed by getClass().getResourceAsStream("/config-file-name"), which works well. I choose…
Chris Zheng
  • 1,509
  • 1
  • 15
  • 20
0
votes
0 answers

Fix 'java.lang.NoSuchMethodError' conflict between ReportPortal & com.fasterxml.jackson in Maven Cucumber project

I'm using the Report Portal dependency in my Maven Cucumber project, along with a separate JAR library that I've incorporated by installing it in the M2 folder. Both of these libraries internally rely on the 'com.fasterxml.jackson.dataformat'…
0
votes
0 answers

exec-maven-plugin ClassNotFoundException

I am trying to start a jar from a dependency with the exec-maven-plugin Thats the Code in my Project "MainProject" inside the POM org.codehaus.mojo exec-maven-plugin
Beanssss
  • 65
  • 5
0
votes
0 answers

Why can't I read MANIFEST.MF file generated by maven when packaging jar?

I have two separate projects: one is spring-boot with jar packaging, and one is a non-spring-boot app with war packaging. In my spring-boot application, I use maven-jar-plugin to generate MANIFEST.MF with custom entries like following:
0
votes
3 answers

How to add classpath to maven

I want to create an executable jar with dependencies that are going to be outside the archive in folder lib. I found out that i can ask maven to copy dependencies into the folder and modify manifest file in my executable to know where to look for…
sav_
  • 1
  • 4
0
votes
0 answers

Cannot build executable jar using maven-jar-plugin when migrating to java 9 modules

I am introducing java 9 modules to a big project and I am facing an issue when trying to build an executable JAR (on one of the sub module) using the maven-jar-plugin. Here is a small view of my project: ├───my-sub-module │ ├───pom.xml │ …
Mr. D
  • 657
  • 1
  • 8
  • 21
0
votes
0 answers

How to pack properties file in jar using maven

I have been trying to pack the properties file inside my jar using Maven but no luck so far. Project Structure: src/main/java All java source files src/test/java All test java source files src/main/resource All properties files. For…
Varun Jain
  • 1,371
  • 12
  • 26
0
votes
1 answer

How to configure the properties of the maven plug-ins in the "properties" section

To configure the main class declared in the manifest file for the jar and assembly plugins I have to open configuration tags in the plugin declaration as in the example below: org.apache.maven.plugins
0
votes
0 answers

Maven Sonatype Release does not work: JAR will be empty - no content was marked for inclusion

I am trying to release a jar, but every release does not contain any classes. I tried several plugin configurations you can find here, here and here but nothing changed. When I try to create a single jar this jar does contain everything, which…
0
votes
1 answer

Exclude files from src/main/java and src/main/resources spring boot jar

I am trying to exclude some java files from src/main/java and also some yml files from src/main/resources folder while building the jar using spring boot maven plugin. I have tried the following options: Option 1 in maven-jar-plugin
0
votes
0 answers

How to specify a new location for the maven-jar plugin to drop needed libraries

I'm trying to build my project with Maven and libraries keep being dropped at /target. I was able to select a new output directory for my project's jar with the outputDirectory tag. How I can select the directory for the needed jar files to run my…
user12484384
0
votes
1 answer

Can't get maven-assembly-plugin to package tests

I would like to produce a fat/standalone jar which contains both my test classes and test-scope dependencies. Using the maven-jar-plugin, I can create a jar which contains my test classes but it does not contain dependencies. Reading the internet,…
Yana K.
  • 1,926
  • 4
  • 19
  • 27