Rayouma
Rayouma

Reputation: 152

Hide the version of a jar in a build having packaging type "ear"

I work with Maven2. I want to know is there a way to hide the version of the jar after the build with packaging type "ear".

For example if:

  1. I use junit with version 5 i want to get it in my ear with the name junit.jar and not junit-5.jar.
  2. I use an external jar named "file.jar" and i do build with type of packaging "ear" and i want that after the build this jar will added in the ear with his same original name "file.jar" and not "file-version.jar".

I'm not using plugin, i'm just dependency: I have this pom for example:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>project</groupId>
  <artifactId>project</artifactId>
  <version>1</version>
  <packaging>ear</packaging>
  <dependencies>
    <dependency>
        <groupId>file</groupId>
        <artifactId>file</artifactId>
        <version>1</version> // just because it can't be empty
        <type>jar</type>
    </dependency>
  </dependencies>
</project>

And I have installed the file.jar in my local repository by using mvn install:install-file

And I want to have as artifact an ear "project.ear" that contains the file.jar without the version name (not file-1.jar)!

Upvotes: 1

Views: 957

Answers (2)

Salandur
Salandur

Reputation: 6453

Set the fileNameMapping property of the ear pluging:

<configuration>
  <fileNameMapping>no-version</fileNameMapping>
</configuration>

this is not in the documentation, but should work.

edit: i just have a look at the source of the plugin and this is only in availible in the latest snapshot version of the ear plugin (2.5-SNAPHOT)

Upvotes: 1

Colin Hebert
Colin Hebert

Reputation: 93177

You just have to set the name with the <bundleFileName> tag in your <***Module>.

But I must say, I don't really see the point of having a more obscure name for an jar.


Resources :

Upvotes: 1

Related Questions