Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-102

Allow optional parts in the patterns

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.2
    • 1.3-RC1
    • Core
    • None

    Description

      Hi,

      we have some artifacts without revisions in our repositories.
      See also discussion http://www.jayasoft.org/node/192 .

      However, it is critical for us that the artifact name is not altered if we download the artifact from the repository.
      For instance, if we download "jta.jar", we don't want to end up with the filename "jta-.jar"

      In order to provide a more general solution, I've enhanced the pattern syntax and included optional parts in the pattern.
      If you surround a token with '(' and ')', any other text which is between the brackets will be ignored if the token has no value.

      Let me give an example:
      the current default pattern of the cache is: [organisation]/[module]/[type]s/[artifact]-[revision].[ext]
      jta.jar wil be renamed to jta-.jar

      if you change this to [organisation]/[module]/[type]s/[artifact](-[revision]).[ext]
      jta.jar wil renamed to jta.jar, because [revision] has no value, and thus the - which is between the brackets will be ignored

      another example
      suppose the pattern: "abc(def[type]ghi)"
      type = "jar" -> the substituted pattern: abcdefjarghi
      type = null or "" -> the substitued pattern: abc

      Is it possible to add this behaviour to Ivy?

      I'll upload a modified substituteTokens(pattern, tokens) method of IvyPatternHelper which implements this behaviour.

      thanks,
      Maarten

      Attachments

        Activity

          People

            xavier Xavier Hanin
            maartenc Maarten Coene
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: