wood burning stoves*
The moose likes Ant, Maven and Other Build Tools and the fly likes war with dependencies but different names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "war with dependencies but different names" Watch "war with dependencies but different names" New topic
Author

war with dependencies but different names

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979


and dependency in the repository is 1.x

How can i have the dependency and at the same time bundle it with a different name?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there,

I'm not really sure what you mean by this question. Are you trying to bundle the commons-beanutils jar in the WAR file but using a different name?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi,

Apologies if i was not clear about the question

I actually have a dependency say spring-2.0.jar in my repository.

For the war, i want to have the dependecy and bundle it with the name spring.jar.

I tried all but it always is getting embedded as spring-2.0.jar

Thanks in advance

Regards
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

That makes sense

Can I ask why you want to rename this? It's usually a very good idea to know exactly what versions you have in an archive and is definitely encouraged by Maven.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16098
    
  21

It's not a good idea to rename the jar. The app doesn't care what the jar's name is, and if you remove the version number, you're discarding information that might be important to know someday.

Also, if there's a dependency on a certain version and you force a different version to be included, you may have problems. The reason dependencies carry version identifiers is that they want to make sure apps don't fail because an incompatible version was included.

Most importantly, there's no reason why you should be including beanutils manually. Beanutils is available as a Maven repository resource, so you should declare it as a dependency if you need to. If it's referenced by one of your other dependencies (such as Struts), you won't have to, since the dependencies cascade.

If you're customizing BeanUtils for some reason, make the custom BeanUtils a Maven project, use mvn install to install the custom version in your repository and use the dependency mechanism in the same way you would for one of the standard BeanUtils releases.


Customer surveys are for companies who didn't pay proper attention to begin with.
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
I have used spring or commons-xxxx.jar names as a reference.

We previously were building the applications using the IDE and then using ant. So this particular jar was a dependency for one of the war and is embedded within it.

Currenlty as part of maven migration,i have installed the same to the repository as x-1.0.jar.

Now as part of the war build,i want to embed it to the war as x.jar and not as x-1.0.jar


Regards
[ October 28, 2008: Message edited by: A Kumar ]
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Am not in the office to check this out....but would this help out.


file-name-mappingl
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I believe that will do the trick yes, but I'll re-iterate what the others have said and say that I would personally keep the version numbers
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
unfortunately that didnt work out
 
GeeCON Prague 2014
 
subject: war with dependencies but different names