Discussion:
Removing version when creating a jar
RobJac
2006-04-12 15:56:59 UTC
Permalink
I have a project A which i have successfully compiled and packaged. Now when
i try to run mvn install, it tries to create a jar into my local repository.
But its appending the verion also to the jar file which i really want to
avoid. For example in the pom.xml of project A file i have given
<project>
<groupId>A</groupId>
<artifactId>A</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
</project>

So its creating a jar file as A-1.0.jar which i dont want to have I just
want it as A.jar. I believe version tag is mandatory as i tried removing it.
Please advice

Thanks in advance
Robin
--
View this message in context: http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a3884329
Sent from the Maven - Users forum at Nabble.com.
Wayne Fay
2006-04-12 15:59:41 UTC
Permalink
You can remove the version number from your artifact by using the
following tag in your pom:

<build>
<finalName>${project.artifactId}</finalName>
</build>

Wayne
Post by RobJac
I have a project A which i have successfully compiled and packaged. Now when
i try to run mvn install, it tries to create a jar into my local repository.
But its appending the verion also to the jar file which i really want to
avoid. For example in the pom.xml of project A file i have given
<project>
<groupId>A</groupId>
<artifactId>A</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
</project>
So its creating a jar file as A-1.0.jar which i dont want to have I just
want it as A.jar. I believe version tag is mandatory as i tried removing it.
Please advice
Thanks in advance
Robin
--
View this message in context: http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a3884329
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
RobJac
2006-04-20 17:40:16 UTC
Permalink
I can actually remove the version when i package, but when i execute mvn
installl for the project it again places the project-version.jar in my
localrepository under the following folder path
<localRepository>/{groupId}/{version}/project-version.jar. I am facing an
issue when i am trying to create an EAR. Since all the projects are getting
created from the the local repository all the projects are getting appended
with version number which I want to avoid. Please let me know how i can
avoid gettuing the version number appended when i execute mvn install for a
project or Can i over ride the name of the dependency project jars when
they are fetched from the repository?
--
View this message in context: http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a4012162
Sent from the Maven - Users forum at Nabble.com.
Nic Holbrook
2006-04-24 11:46:18 UTC
Permalink
What I do to get around this is let maven do its thing then when I
deploy the jars, I use an ant task to copy the correct file out to my
server using the name minus the version.
Post by RobJac
I can actually remove the version when i package, but when i execute mvn
installl for the project it again places the project-version.jar in my
localrepository under the following folder path
<localRepository>/{groupId}/{version}/project-version.jar. I am facing an
issue when i am trying to create an EAR. Since all the projects are getting
created from the the local repository all the projects are getting appended
with version number which I want to avoid. Please let me know how i can
avoid gettuing the version number appended when i execute mvn install for a
project or Can i over ride the name of the dependency project jars when
they are fetched from the repository?
--
View this message in context: http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a4012162
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
[tch]
Arik Kfir
2006-04-24 17:56:36 UTC
Permalink
sorry for butting in - but why would you want to do that?
Post by Nic Holbrook
What I do to get around this is let maven do its thing then when I
deploy the jars, I use an ant task to copy the correct file out to my
server using the name minus the version.
Post by RobJac
I can actually remove the version when i package, but when i execute mvn
installl for the project it again places the project-version.jar in my
localrepository under the following folder path
<localRepository>/{groupId}/{version}/project-version.jar. I am facing an
issue when i am trying to create an EAR. Since all the projects are
getting
Post by RobJac
created from the the local repository all the projects are getting
appended
Post by RobJac
with version number which I want to avoid. Please let me know how i can
avoid gettuing the version number appended when i execute mvn install
for a
Post by RobJac
project or Can i over ride the name of the dependency project jars when
they are fetched from the repository?
--
http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a4012162
Post by RobJac
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
[tch]
---------------------------------------------------------------------
--
______________________________________
Cheers,
Arik Kfir ***@gmail.com
Linux user, number 415067 - http://counter.li.org/
http://corleon.dnsalias.org
Wayne Fay
2006-04-24 18:40:13 UTC
Permalink
I've never understood this desire to remove version numbers from Jars
built by Maven... In fact, I can't stand it when I run across a jar
with no version number and have to dig into it to find a version
either in a manifest or other random file.

Wayne
Post by Arik Kfir
sorry for butting in - but why would you want to do that?
Post by Nic Holbrook
What I do to get around this is let maven do its thing then when I
deploy the jars, I use an ant task to copy the correct file out to my
server using the name minus the version.
Post by RobJac
I can actually remove the version when i package, but when i execute mvn
installl for the project it again places the project-version.jar in my
localrepository under the following folder path
<localRepository>/{groupId}/{version}/project-version.jar. I am facing an
issue when i am trying to create an EAR. Since all the projects are
getting
Post by RobJac
created from the the local repository all the projects are getting
appended
Post by RobJac
with version number which I want to avoid. Please let me know how i can
avoid gettuing the version number appended when i execute mvn install
for a
Post by RobJac
project or Can i over ride the name of the dependency project jars when
they are fetched from the repository?
--
http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a4012162
Post by RobJac
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
[tch]
---------------------------------------------------------------------
--
______________________________________
Cheers,
Linux user, number 415067 - http://counter.l
Nic Holbrook
2006-04-24 13:16:15 UTC
Permalink
One of the reasons I do this now is because the new ejb3 spec allows for
looking up objects based on a class. These new jndi objects are scoped
based on the name of the ear. I remove the version so that I can keep
the same code and reference the objects through jndi the same way each
time. I believe there is a mechanism to override these names and
provide your own, but I'm just a lazy programmer...

Nic
Post by Arik Kfir
sorry for butting in - but why would you want to do that?
Post by Nic Holbrook
What I do to get around this is let maven do its thing then when I
deploy the jars, I use an ant task to copy the correct file out to my
server using the name minus the version.
Post by RobJac
I can actually remove the version when i package, but when i execute mvn
installl for the project it again places the project-version.jar in my
localrepository under the following folder path
<localRepository>/{groupId}/{version}/project-version.jar. I am facing an
issue when i am trying to create an EAR. Since all the projects are
getting
Post by RobJac
created from the the local repository all the projects are getting
appended
Post by RobJac
with version number which I want to avoid. Please let me know how i can
avoid gettuing the version number appended when i execute mvn install
for a
Post by RobJac
project or Can i over ride the name of the dependency project jars when
they are fetched from the repository?
--
http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a4012162
Post by RobJac
Sent from the Maven - Users forum at Nabble.com.
---------------------------------------------------------------------
[tch]
---------------------------------------------------------------------
--
______________________________________
Cheers,
Linux user, number 415067 - http://counter.li.org/
http://corleon.dnsalias.org
[tch]
RobJac
2006-04-24 18:12:18 UTC
Permalink
I have found a way to remove the version, in my ear pom xml i am using under
the configuration of my ear-plugin

<javaModule>
<groupId>Test</groupId>
<artifactId>Test</artifactId>

<bundleFileName>Test.jar</bundleFileName>
</javaModule>
<webModule>
<groupId>Test_WEB</groupId>
<artifactId>Test_WEB</artifactId>
<bundleFileName>Test_WEB.war</bundleFileName>
</webModule>
--
View this message in context: http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a4069067
Sent from the Maven - Users forum at Nabble.com.
ruelloehr
2006-04-24 17:23:07 UTC
Permalink
No. The version is always placed in the name when uploaded into the
repository. There is not a way around this.
--
View this message in context: http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.html#a4068132
Sent from the Maven - Users forum at Nabble.com.
Mike Perham
2006-04-24 18:57:22 UTC
Permalink
Usually because you have something like a reference by name in something
like EAR's application.xml and don't want to update that file every time
the version changes. Having changes ripple to modules downstream is a
nightmare to deal with and so referring without version solves that
problem.

I agree that removing the version "just because" is a poor decision.

-----Original Message-----
From: Wayne Fay [mailto:***@gmail.com]
Sent: Monday, April 24, 2006 1:40 PM
To: Maven Users List
Subject: Re: Removing version when creating a jar

I've never understood this desire to remove version numbers from Jars
built by Maven... In fact, I can't stand it when I run across a jar with
no version number and have to dig into it to find a version either in a
manifest or other random file.

Wayne
Post by Arik Kfir
sorry for butting in - but why would you want to do that?
Post by Nic Holbrook
What I do to get around this is let maven do its thing then when I
deploy the jars, I use an ant task to copy the correct file out to
my server using the name minus the version.
Post by RobJac
I can actually remove the version when i package, but when i
execute mvn installl for the project it again places the
project-version.jar in my localrepository under the following
folder path
<localRepository>/{groupId}/{version}/project-version.jar. I am
facing an issue when i am trying to create an EAR. Since all the
projects are
getting
Post by RobJac
created from the the local repository all the projects are getting
appended
Post by RobJac
with version number which I want to avoid. Please let me know how i
can avoid gettuing the version number appended when i execute mvn
install
for a
Post by RobJac
project or Can i over ride the name of the dependency project jars
when they are fetched from the repository?
--
http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.
html#a4012162
Post by RobJac
Sent from the Maven - Users forum at Nabble.com.
-------------------------------------------------------------------
[tch]
--------------------------------------------------------------------
--
______________________________________
Cheers,
Linux user, number 415067 - http://counter.li.org/
http://corleon.dnsalias.org
Alexandre Poitras
2006-04-24 19:39:18 UTC
Permalink
But Maven can filter application.xml so it isn't a problem.

Seriously I can understand when you deploy in a external location but
why would you want to mess up Maven in his local respository? How do
you want Maven to manage your artifact if you don't give him the
informations it needs to do its work. It's like asking Eclipse to run
based upon your own project descriptor.

A Maven repository should only be used by Maven and so follow it
conventions. If you need to keep the jar in another format or to
follow certain constraints for some reasons copy or link the file
elsewhere in the filesystem. Simple as that. This what I always do and
it works fine.
Post by Mike Perham
Usually because you have something like a reference by name in something
like EAR's application.xml and don't want to update that file every time
the version changes. Having changes ripple to modules downstream is a
nightmare to deal with and so referring without version solves that
problem.
I agree that removing the version "just because" is a poor decision.
-----Original Message-----
Sent: Monday, April 24, 2006 1:40 PM
To: Maven Users List
Subject: Re: Removing version when creating a jar
I've never understood this desire to remove version numbers from Jars
built by Maven... In fact, I can't stand it when I run across a jar with
no version number and have to dig into it to find a version either in a
manifest or other random file.
Wayne
Post by Arik Kfir
sorry for butting in - but why would you want to do that?
Post by Nic Holbrook
What I do to get around this is let maven do its thing then when I
deploy the jars, I use an ant task to copy the correct file out to
my server using the name minus the version.
Post by RobJac
I can actually remove the version when i package, but when i
execute mvn installl for the project it again places the
project-version.jar in my localrepository under the following
folder path
<localRepository>/{groupId}/{version}/project-version.jar. I am
facing an issue when i am trying to create an EAR. Since all the
projects are
getting
Post by RobJac
created from the the local repository all the projects are getting
appended
Post by RobJac
with version number which I want to avoid. Please let me know how i
can avoid gettuing the version number appended when i execute mvn
install
for a
Post by RobJac
project or Can i over ride the name of the dependency project jars
when they are fetched from the repository?
--
http://www.nabble.com/Removing-version-when-creating-a-jar-t1438924.
html#a4012162
Post by RobJac
Sent from the Maven - Users forum at Nabble.com.
-------------------------------------------------------------------
[tch]
--------------------------------------------------------------------
--
______________________________________
Cheers,
Linux user, number 415067 - http://counter.li.org/
http://corleon.dnsalias.org
---------------------------------------------------------------------
Loading...