You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Martin (JIRA)" <ji...@apache.org> on 2017/11/27 09:09:00 UTC

[jira] [Comment Edited] (IVY-871) test and document PatternVersionMatcher

    [ https://issues.apache.org/jira/browse/IVY-871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16266533#comment-16266533 ] 

Martin edited comment on IVY-871 at 11/27/17 9:08 AM:
------------------------------------------------------

Sure. I am publishing artifacts by following semantic versioning plus some extension to mark a released artifact of a specific release. The format is like this {{1.2.3-X.Y}} or {{1.2.4-X.Y-SNAPSHOT}}. All these artifacts are published to the same release repository. So we end up with having various release artifacts (1.2.3-X.Y|-SNAPSHOT) and as well regular ones from trunk (1.2.3).

In order to get the latest artifacts from a specific release (X.Y) we cannot use the latest.release/snapshot matchers. I read in the documentation about the version matchers and tried to implement something that will get the latest revision from a specific release.

I have the following ivy settings:

{code}
<match revision="latestRel" pattern="\d+\.\d+\.\d+-${release}\.*" args="release" matcher="regexp" />
{code}

I use the Ivy standalone tool by passing the ivysettings.xml and the dependency as following:

{{code}}
java -jar ivy.jar -settings ivysettings.xml -dependency com.acme mylib "latestRel(17.4)"
{{code}}

This works and pulls only the latest artifact with the release 17.4 only but I do not understand why exactly and have the feeling that it works by accident.


was (Author: martinm82):
Sure. We are publishing artifacts by following semantic versioning plus some extension to mark a released artifact of a specific release. The format is like this {{1.2.3-X.Y}} or {{1.2.4-X.Y-SNAPSHOT}}. All these artifacts are published to the same release repository. So we end up with having various release artifacts (1.2.3-X.Y|-SNAPSHOT) and as well regular ones from trunk (1.2.3).

In order to get the latest artifacts from a specific release (X.Y) we cannot use the latest.release/snapshot matchers. I read in the documentation about the version matchers and tried to implement something that will get the latest revision from a specific release.

I have the following ivy settings:

{code}
<match revision="latestRel" pattern="\d+\.\d+\.\d+-${release}\.*" args="release" matcher="regexp" />
{code}

I use the Ivy standalone tool by passing the ivysettings.xml and the dependency as following:

{{code}}
java -jar ivy.jar -settings ivysettings.xml -dependency com.acme mylib "latestRel(17.4)"
{{code}}

This works and pulls only the latest artifact with the release 17.4 only but I do not understand why exactly and have the feeling that it works by accident.

> test and document PatternVersionMatcher
> ---------------------------------------
>
>                 Key: IVY-871
>                 URL: https://issues.apache.org/jira/browse/IVY-871
>             Project: Ivy
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Xavier Hanin
>            Assignee: Maarten Coene
>             Fix For: 2.1.0-RC2
>
>         Attachments: patch.txt
>
>
> There is a powerful version matcher in Ivy code base called PatternVersionMatcher. Unfortunately, this matcher is not documented, not tested, and not declared in the default typedef.properties. Nobody remembers where it comes from, but code analysis should be enough to understand how it works and what it can achieve.
> Here's what I understand from a quick analysis:
> {code:title=settings.xml}
> <pattern-vm>
>   <match revision="micro" pattern="${major}\.${minor}\.\d+" args="major, minor" matcher="regexp" />
> </pattern-vm>
> {code}
> {code:title=ivy.xml}
> <dependency org="acme" name="foo" rev="micro(1, 3)" />
> {code}
> If I understand correctly the code, this will match any revision like 1.3.<any number>.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)