Maven 2.x Ant Tasks

more powerful filesetId

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0.4, 2.0.6
  • Fix Version/s: 2.0.7
  • Component/s: dependencies task
  • Labels:
    None
  • Number of attachments :
    5

Description

I would like to copy all dependencies into a 'lib' directory without version numbers in the filename. I don't think I can safely determine which part of the filename is the artifact and which part is the version number. Only maven knows that, so I think the m2 ant tasks need something more flexible than the current filesetId.

Brett Porter suggests:

Basically, filesetId references the local repository directory, so it
will need to be something that:
1) produces a reference to all the artifacts downloaded for use later
2) can be used as a mapper in association with the filesetId produced

  1. MANTTASKS-29_site.diff
    29/May/07 9:43 AM
    4 kB
    Herve Boutemy
  2. MANTTASKS-29.diff
    29/May/07 9:43 AM
    8 kB
    Herve Boutemy
  3. MANTTASKS-29-bis.diff
    31/May/07 1:49 PM
    3 kB
    Herve Boutemy
  4. maven-ant-tasks_mapper.patch
    30/Mar/07 6:18 PM
    6 kB
    Herve Boutemy
  5. maven-ant-tasks_mapper-2.patch
    31/Mar/07 5:54 AM
    7 kB
    Herve Boutemy

Activity

Hide
Herve Boutemy added a comment -

Here is a patch to be able to remove versions from filenames, securely and consistently.

The idea is :
1. add a "versionsPropertyName" attribute to dependencies task: this task will set the property with a String representing the misc versions of resolved artifacts (with file separator)
2. a custom mapper that will take this version info as from property: it will do the mapping itself

Look at the sample.build.xml part of the patch to see the way of using it.

Show
Herve Boutemy added a comment - Here is a patch to be able to remove versions from filenames, securely and consistently. The idea is : 1. add a "versionsPropertyName" attribute to dependencies task: this task will set the property with a String representing the misc versions of resolved artifacts (with file separator) 2. a custom mapper that will take this version info as from property: it will do the mapping itself Look at the sample.build.xml part of the patch to see the way of using it.
Hide
Herve Boutemy added a comment -

added a new option to="flatten": the usual case where we want to flatten and remove the version is now done with one single mapper

Show
Herve Boutemy added a comment - added a new option to="flatten": the usual case where we want to flatten and remove the version is now done with one single mapper
Hide
Herve Boutemy added a comment -

Here is a new patch for a VersionMapper, with corresponding documentation.

Here si the typical use case (taken from the documentation):

<artifact:dependencies filesetId="dependency.fileset"
        sourcesFilesetId="sources.dependency.fileset" versionsId="dependency.versions">
...
</artifact:dependencies>
<copy todir="lib">
  <fileset refid="dependency.fileset" />
  <mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper"
          from="${dependency.versions}" to="flatten" />
</copy>
<copy todir="lib/src">
  <fileset refid="sources.dependency.fileset" />
  <mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper"
          from="${dependency.versions}" to="flatten" />
</copy>
Show
Herve Boutemy added a comment - Here is a new patch for a VersionMapper, with corresponding documentation. Here si the typical use case (taken from the documentation):
<artifact:dependencies filesetId="dependency.fileset"
        sourcesFilesetId="sources.dependency.fileset" versionsId="dependency.versions">
...
</artifact:dependencies>
<copy todir="lib">
  <fileset refid="dependency.fileset" />
  <mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper"
          from="${dependency.versions}" to="flatten" />
</copy>
<copy todir="lib/src">
  <fileset refid="sources.dependency.fileset" />
  <mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper"
          from="${dependency.versions}" to="flatten" />
</copy>
Hide
Jason van Zyl added a comment -

Patch applied.

Show
Jason van Zyl added a comment - Patch applied.
Hide
Herve Boutemy added a comment -

forgot "svn add src/main/java/org/apache/maven/artifact/ant/VersionMapper.java"...

Show
Herve Boutemy added a comment - forgot "svn add src/main/java/org/apache/maven/artifact/ant/VersionMapper.java"...

People

Vote (2)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: