tags:

views:

41

answers:

3

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)!

A: 

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 :

Colin Hebert
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 be added in the ear with his same original name "file.jar" and not "file-version.jar".
Rayouma
+1  A: 

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)

Salandur
And where can I found this version 2.5?
Rayouma
http://maven.apache.org/guides/development/guide-testing-development-plugins.html
Salandur
A: 

Hi,

This is not an answer, but just to make the problem a little bit more comprehensive.

If you create a simple ear, with only one dependency (let's say junit-3.8.jar), when you package that ear, you will have the junit jar packaged into the ear with its version on its name. What do Rayouma wants, is to hide the jar's version, so that into the ear, we just find: junit.jar.

I hope this make things clearer.

P.S: I'm facing the same problem.

b-lieve