Maven 1.x War Plugin
  1. Maven 1.x War Plugin
  2. MPWAR-61

Renaming jar file with war.target.pathfile

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.3
    • Labels:
      None
    • Environment:
      maven 1.x
      eclipse 3.1.2
    • Number of attachments :
      1

      Description

      Hi,
      I had a little problem during the creation of a war file.
      Here is an example :
      I add a applet-1.0.0.jar in the dependencies
      I don't put the applet in WEB-INF/lib so I use the property : war.target.path
      <war.target.path>lib/</war.target.path>

      But, this applet have a version number and I don't want to change my jsp each time I change the dependencies.
      I modify the plugin to add the rename of the file :
      I add a option (line 172 of plugin.jelly) :
      <j:set var="targetPathFile" value="$

      {dep.getProperty('war.target.pathfile')}

      "/>
      <j:if test="$

      {!empty(targetPathFile)}

      ">
      <ant:copy tofile="$

      {maven.war.webapp.dir}

      /$

      {targetPathFile}

      " file="$

      {lib.path}

      "/>
      </j:if>

      So I can use :
      <war.target.pathfile>lib/applet.jar</war.target.pathfile>

      and now I can just change the dependencies and not the jsp file.

      Is it a wrong way or can you add this options in the plugin ?

        Activity

        Hide
        Arnaud Heritier added a comment -

        I would prefer a property like war.target.filename to be more coherent with some others plugins.
        The code could be :

         
        <j:set var="targetPath" value="${dep.getProperty('war.target.path')}"/> 
        <j:set var="targetFileName" value="${dep.getProperty('war.target.filename')}"/> 
        <j:choose>
          <j:when test="${!empty(targetPath) and empty(targetFileName)}">
            <ant:copy todir="${maven.war.webapp.dir}/${targetPath}" file="${lib.path}"/>
          </j:when>
          <j:when test="${!empty(targetPath) and !empty(targetFileName)}">
            <ant:copy tofile="${maven.war.webapp.dir}/${targetFileName}" file="${lib.path}"/>
          </j:when>
        </j:choose>
        

        And the settings :

         
        <war.target.path>lib/</war.target.path>
        <war.target.filename>applet.jet</war.target.filename>
        
        Show
        Arnaud Heritier added a comment - I would prefer a property like war.target.filename to be more coherent with some others plugins. The code could be : <j:set var= "targetPath" value= "${dep.getProperty('war.target.path')}" /> <j:set var= "targetFileName" value= "${dep.getProperty('war.target.filename')}" /> <j:choose> <j:when test= "${!empty(targetPath) and empty(targetFileName)}" > <ant:copy todir= "${maven.war.webapp.dir}/${targetPath}" file= "${lib.path}" /> </j:when> <j:when test= "${!empty(targetPath) and !empty(targetFileName)}" > <ant:copy tofile= "${maven.war.webapp.dir}/${targetFileName}" file= "${lib.path}" /> </j:when> </j:choose> And the settings : <war.target.path> lib/ </war.target.path> <war.target.filename> applet.jet </war.target.filename>
        Hide
        Stéphane Nicoll added a comment -

        This is implemented. There was a small issue with the patch that I've fixed. Added tes06 to test this scenario.

        Show
        Stéphane Nicoll added a comment - This is implemented. There was a small issue with the patch that I've fixed. Added tes06 to test this scenario.

          People

          • Assignee:
            Stéphane Nicoll
            Reporter:
            hugo lassiege
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: