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

How to remove a a specific directory from the Maven's target directory at the end of the build?

I have a task to unpack all the jars mentioned in the pom.xml and then jar the unpacked content into one single jar. I am able to do this using the unpack-dependency goal of the dependency plugin and the jar plugin. However, after i generate the…
1
vote
1 answer

Validate manifest.mainClass in maven-jar-plugin

Is there a way to validate (even using another plugin) that the mainClass specified for the maven-jar-plugin is a valid class, and even better that it has a public static void main(String[] argv) method? It is common that after refactoring, this is…
flungo
  • 1,050
  • 1
  • 7
  • 21
1
vote
1 answer

How to download the souce of jars to custom location in maven?

This is follow up post of How to get all the specified jars mentioned in the pom.xml and transitively dependent jars? Except that I am looking to download the source of the both dependent and transitively dependent jars to custom mentioned…
1
vote
1 answer

Maven packing properties file

I have a maven multi-module projects layered as follows. test-integration - test-integration.properties test-services - test-services.properties test-persistence - test-persistence.properties There is a property file in each of the…
Lewis Wong
  • 269
  • 1
  • 3
  • 17
1
vote
1 answer

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar

So I was trying to go ahead and create a .ear file for an existing maven project and further deploy it on WebLogic server. For the same, I went ahead to create the WAR,JAR and the EAR module and followed these steps for it - Right click on parent…
TheLuminor
  • 1,411
  • 3
  • 19
  • 34
1
vote
1 answer

Maven - Generate test jar without its classifier name (tests)

I'm currently generating a test jar using maven-jar-plugin with test-jar as goal. This is producing the test jar that I want but the file name has a -tests classifier suffixed. I would want my test jar to be generated without the -test on it. I…
Arun S
  • 135
  • 1
  • 12
1
vote
1 answer

Remove tests classifier of Maven jar:test-jar goal?

I have configured the maven-jar-plugin as follow: org.apache.maven.plugins maven-jar-plugin 2.3.2 ${project.artifactId}.main
Simon Kissane
  • 4,373
  • 3
  • 34
  • 59
1
vote
0 answers

How to refactor test classes that extend JUnit classes

We are using classifiers in our builds to distinguish our artifacts. The problem is that we are also using the maven-jar plugin to create a test-jar which has some test classes we use elsewhere. Since the test-jar goal uses classifiers to…
Carlos Bribiescas
  • 4,197
  • 9
  • 35
  • 66
1
vote
1 answer

How to add src/test/java contents to the output maven jar that gets created

I see a lot of similar questions. But unable to make this work. I have tried testresources and build-helper-maven-plugin so far Also I read in 1 thread how to write my own assembly plugin to do something like that. But posting this again to see if…
1
vote
1 answer

maven - how to compile code to jar file and not .class

I am trying to build a groovy project using maven. My packaging type is war file. Maven is building the project and putting all dependent libraries in WEB-INF/lib folder but it is compiling all code into class files and putting it into…
AabinGunz
  • 12,109
  • 54
  • 146
  • 218
1
vote
0 answers

Create multiple jars based on multiple packages with Maven

I want to create multiple jars in one maven project. The number of jars that would be generated is not known explicitly. It depends on the number of some packages. I found how to create a jar with maven-jar-plugin based on explicity pointed…
LancerX
  • 1,211
  • 7
  • 23
  • 40
1
vote
1 answer

How to use jar:jar goal in maven-jar-plugin to build multiple jar files

Our pom.xml has multiple executions inside the maven-jar-plugin with the intention of creating three separate jar files. What is the means to invoke mvn and build the three jars? Presently mvn compile jar:jar still creates only a single jar. …
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
1
vote
1 answer

Maven: Producing two jars from one project not recommended. Why?

The case where I would like to generate a second artefact is this. We have builder-classes in the test Code that i would like to reuse in another project. I found this guide-attached-tests and it works fine. After some discussion with my coworkers I…
1
vote
1 answer

Maven error: Cannot find setter, adder nor field in org.apache.maven.archiver.ManifestConfiguration for 'useUniqueVersions'

My Maven build fails with the error message: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.2:jar (default-jar) on project XXX: Unable to parse configuration of mojo org.apache.maven.plugins:maven-jar-plugin:2.2:jar for…
thSoft
  • 21,755
  • 5
  • 88
  • 103
1
vote
2 answers

Maven (Eclipse plugin and mvn) not including main class with pom.xml setup

I've been trying to work this out for the last few hours and I've got nowhere. I've just installed the Maven for Eclipse plugin (M2E, I think) and also the maven too, mvn. I've created a very simple Hello World project and am trying to get the built…
Ooberdan
  • 720
  • 1
  • 6
  • 18