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
2
votes
1 answer

How do I avoid an empty test JAR in Maven?

I have Maven configured to create test JARs for all builds (snapshot and release) like so:
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
2
votes
1 answer

How to create Maven Jar file when tests contain JUnit @Test annotations and no main class

I have 3 tests stored under a package that all take advantage of the JUnit @Test annotation. I do not have a main class in the project. Naturally, I can go Run As > Maven Test and all 3 tests will get executed. I created a Jar executable file using…
Nazrod12
  • 111
  • 1
  • 2
  • 9
2
votes
1 answer

How to force Maven to always create a new jar file?

If all classes are up-to-date "Nothing to compile - all classes are up to date" so will maven create jar again? As I am seeing in my log that jar is not creating again. so maven come to know that all classes are up-to-date. Question: is there any…
Musaddique S
  • 1,539
  • 2
  • 15
  • 36
2
votes
2 answers

maven-gwt-plugin and packaging to JAR

I'm rewriting legacy Spring project build script from Ant to Maven. The project has several GWT modules, each compiled to JAR. The current project structure consists of several Maven modules, which is more or less like this: mainProject |-…
yuiu
  • 93
  • 10
2
votes
1 answer

Bind jar:test-jar to package phase

I have a pom snippet containing the following: org.apache.maven.plugins maven-jar-plugin 2.6
jbwt
  • 384
  • 5
  • 14
2
votes
1 answer

how to exclude jar file from getting installed using maven-install-plugin?

I have a jar file created using maven-jar-plugin. Is there a way to skip this jar file from getting installed in repository? Thanks in advance.
Sanchit Nagpal
  • 141
  • 1
  • 1
  • 4
2
votes
1 answer

Using the maven jar plugin with maven shade plugin

following is the structure inside my pom.xml in a multimodule project Module A pom.xml org.apache.maven.plugins maven-shade-plugin
user_mda
  • 18,148
  • 27
  • 82
  • 145
2
votes
2 answers

How do I exclude java files from a jar in maven-jar-plugin?

I created a pom.xml to compile my project and package it as a jar, and indeed it comiples and the jar is created - problem is that i got a jar with both classes and java inside, and i only want the classes inside. How do I lose the java files? I…
Shahar Hamuzim Rajuan
  • 5,610
  • 9
  • 53
  • 91
2
votes
2 answers

resources folder inside jar

I know its not a good practice to put a properties file inside the jar but our scenario dictates that requirement. What i want is to put the contents of resources folder inside the jar as is. In my maven project, the contents of resources are added…
Hammad Dar
  • 475
  • 8
  • 18
2
votes
3 answers

Maven: Output JAR with arbitrary extension

I have a Java project that, when mvn install is executed on it, generates a JAR file. So far so good. After that generation, I'd like to rename the resultant JAR file to something with an arbitrary extension. For example, say the resultant JAR that…
2
votes
1 answer

Can you share manifestEntries in Maven?

In my master POM, I have where I define configurations for the maven-jar-plugin, maven-war-plugin and maven-ear-plugin. Each of these has
Snekse
  • 15,474
  • 10
  • 62
  • 77
1
vote
0 answers

Jitpack builds successfully, but there is no jar file or jar doesn't contain .class files

I'm trying to build my Android library with Jitpack, but it doesn't make any jar file, so I can insert implementation 'com.github.crylent:midilib:fbcf4f6c1e' into a gradle file in another project and successfully sync it, but can't import any…
1
vote
0 answers

`java.lang.NoClassDefFoundError` from javaagent built by `maven package`

I've been trying to build javaagent (containing premain()) to .jar file using maven mvn package, and keep getting java.lang.NoClassDefFoundError exception related to external dependencies. For details, I added kafka-client dependecies and…
1
vote
0 answers

Include external repo files in maven build

There are few externalized property file located like, which are used for DB connections for different environment. http://repo.xx.com/snapshots/a.properties http://repo.xx.com/snapshots/b.properties http://repo.xx.com/snapshots/c.properties During…
user949706
  • 53
  • 4
1
vote
0 answers

How to rename the jar downloaded as dependency in maven

I am trying to include a jar from the repository but I want to rename the jar when I use it. Currently I am doing like org.apache.maven.plugins maven-jar-plugin
Deep
  • 929
  • 2
  • 16
  • 32