jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x WAR Plugin
  • MWAR-211

Ability to rename a dependency's jar when putting it on the lib folder

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: New Feature New Feature
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Maven put on my 'lib' folder the jars of my project's dependencies named like <artefactId>-<version>.jar

This is a problem when we need to reference the jar filename from sourcecode, because if we change the dependency version, we have to track all source code references to it and correct them. This is the case when importing a taglib into a jsp page

It would be better if Maven put only <artefactId>.jar on the lib folder. And even better if it let us use any custom name we want for the dependencies. If no name is specified, then it could use the current pattern.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. File
    TestMaven.rar
    25/Aug/09 5:29 PM
    2 kB
    Magno Machado Paulo

Issue Links

is related to

Bug - A problem which impairs or prevents the functions of the product. MWAR-161 Overridden artifact finalName ist ignored by the war plugin.

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Benjamin Bentmann added a comment - 25/Aug/09 10:57 AM

More than likely, you refer to some Maven plugin and not the Maven core. What exactly is "putting it on the lib folder"? Do you have a POM or debug log to look at?

Show
Benjamin Bentmann added a comment - 25/Aug/09 10:57 AM More than likely, you refer to some Maven plugin and not the Maven core. What exactly is "putting it on the lib folder"? Do you have a POM or debug log to look at?
Hide
Permalink
Magno Machado Paulo added a comment - 25/Aug/09 5:28 PM

Sorry, I think I wasn't clear...
Let's try again..
I'm going to attach a project on this issue where you can see what I'm saying.
First, do a "mvn package" on the project.
Then, go to TestMaven/target/TestMaven/WEB-INF/lib
Among other files, there's a "mentawai-1.14.1.jar" there. What I want is force Maven to rename this jar.
To understand why do I whant this, look at the "TestMaven/src/main/webapp/index.jsp" file.
The first line on thie file is:
<%@ taglib uri="/WEB-INF/lib/mentawai-1.14.1.jar" prefix="mtw" %>
Now imagine I have this line on a lot of source files, and I decide to use a new version of the library. I would have to go on any source file and correct the references.

Now, imagine Maven had renamed this jar to, say, "mentawai.jar". What I'd have on my index.jsp would be:
<%@ taglib uri="/WEB-INF/lib/mentawai.jar" prefix="mtw" %>

And if I decide to move to a different version, I don't have to correct any references.

I think we could have an addicional tag on the dependency declaration, something like this:
<dependency>
<groupId>org.mentaframework</groupId>
<artifactId>mentawai</artifactId>
<version>1.14.1</version>
<scope>compile</scope>
<finalName>mentarai.jar<finalName> <- This is a new tag
</dependency>
And, in the case where this new tag isn't used, Maven would use the current pattern, so it would be 100% backward compatible.

Show
Magno Machado Paulo added a comment - 25/Aug/09 5:28 PM Sorry, I think I wasn't clear... Let's try again.. I'm going to attach a project on this issue where you can see what I'm saying. First, do a "mvn package" on the project. Then, go to TestMaven/target/TestMaven/WEB-INF/lib Among other files, there's a "mentawai-1.14.1.jar" there. What I want is force Maven to rename this jar. To understand why do I whant this, look at the "TestMaven/src/main/webapp/index.jsp" file. The first line on thie file is: <%@ taglib uri="/WEB-INF/lib/mentawai-1.14.1.jar" prefix="mtw" %> Now imagine I have this line on a lot of source files, and I decide to use a new version of the library. I would have to go on any source file and correct the references. Now, imagine Maven had renamed this jar to, say, "mentawai.jar". What I'd have on my index.jsp would be: <%@ taglib uri="/WEB-INF/lib/mentawai.jar" prefix="mtw" %> And if I decide to move to a different version, I don't have to correct any references. I think we could have an addicional tag on the dependency declaration, something like this: <dependency> <groupId>org.mentaframework</groupId> <artifactId>mentawai</artifactId> <version>1.14.1</version> <scope>compile</scope> <finalName>mentarai.jar<finalName> <- This is a new tag </dependency> And, in the case where this new tag isn't used, Maven would use the current pattern, so it would be 100% backward compatible.
Hide
Permalink
Magno Machado Paulo added a comment - 25/Aug/09 5:29 PM

Test project

Show
Magno Machado Paulo added a comment - 25/Aug/09 5:29 PM Test project
Hide
Permalink
Benjamin Bentmann added a comment - 25/Aug/09 5:41 PM - edited

I was told the example File Name Mapping from the Maven WAR Plugin could be what you want.

Show
Benjamin Bentmann added a comment - 25/Aug/09 5:41 PM - edited I was told the example File Name Mapping from the Maven WAR Plugin could be what you want.
Hide
Permalink
Johan Sjöberg added a comment - 21/Dec/09 11:29 AM - edited

If "File Name Mapping" renames TLDs etc. as well, perhaps a tag like <archiveName>myname.jar</archiveName> would be great to complement <archiveClasses>true</archiveClasses>; to be able to replace the default <artefactId>-<version>.jar with myname.jar.

Show
Johan Sjöberg added a comment - 21/Dec/09 11:29 AM - edited If "File Name Mapping" renames TLDs etc. as well, perhaps a tag like <archiveName>myname.jar</archiveName> would be great to complement <archiveClasses>true</archiveClasses>; to be able to replace the default <artefactId>-<version>.jar with myname.jar.
Hide
Permalink
Johan Sjöberg added a comment - 23/Dec/09 5:33 AM

Using <outputFileNameMapping> to control the name of the jar-file produced by the <archiveClasses> tag has SERIOUS side effects. Sure, the jar-file produced from our sources are given the name, but so are also every other external dependency (declared by maven <dependency>...</dependency> tags).

So again, I really propose a tag similar to <archiveName>myname.jar</archiveName>, to be able to control the name of the jar produced from the project sources.

pom.xml excerpt using outputFileNameMapping:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<archiveClasses>true</archiveClasses>
<outputFileNameMapping>prefix-${project.artifactId}-${project.version}.jar</outputFileNameMapping>
</configuration>
</plugin>

Show
Johan Sjöberg added a comment - 23/Dec/09 5:33 AM Using <outputFileNameMapping> to control the name of the jar-file produced by the <archiveClasses> tag has SERIOUS side effects. Sure, the jar-file produced from our sources are given the name, but so are also every other external dependency (declared by maven <dependency>...</dependency> tags). So again, I really propose a tag similar to <archiveName>myname.jar</archiveName>, to be able to control the name of the jar produced from the project sources. pom.xml excerpt using outputFileNameMapping: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1-beta-1</version> <configuration> <archiveClasses>true</archiveClasses> <outputFileNameMapping>prefix-${project.artifactId}-${project.version}.jar</outputFileNameMapping> </configuration> </plugin>
Hide
Permalink
Dennis Lundberg added a comment - 14/Aug/10 2:47 AM

Johan,

Your comments are about other issues than this one.

I haven't seen another issue about renaming TLDs, please file a new issue for that with a description of what it is you want to do.

There are other issues about the name of the project's own JAR file, like MWAR-176. Please add your suggestions there. Or if you feel the need for it - create a new issue.

Show
Dennis Lundberg added a comment - 14/Aug/10 2:47 AM Johan, Your comments are about other issues than this one. I haven't seen another issue about renaming TLDs, please file a new issue for that with a description of what it is you want to do. There are other issues about the name of the project's own JAR file, like MWAR-176. Please add your suggestions there. Or if you feel the need for it - create a new issue.

People

  • Assignee:
    Unassigned
    Reporter:
    Magno Machado Paulo
Vote (3)
Watch (4)

Dates

  • Created:
    25/Aug/09 10:43 AM
    Updated:
    14/Aug/10 2:47 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.