You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by barthel <gi...@git.apache.org> on 2015/07/10 15:36:55 UTC

[GitHub] maven pull request: MNG-3092: Add strategy based version range res...

GitHub user barthel opened a pull request:

    https://github.com/apache/maven/pull/57

    MNG-3092: Add strategy based version range resolver.

    The discussion on issue [MNG-3092](https://issues.apache.org/jira/browse/MNG-3092) shows the seriously needs of different kinds of version range resolving in Maven.
    
    I know about the risk on changing the resolving mechanism in Maven.
    I always had the backward compatibility in mind, if I have something changed.
    I added some basic tests for the default version range resolver (strategy) before I've started with the refactoring.
    
    This pull request contains a solution based on the strategy pattern.
    
    The actual version range resolving algorithm **wasn't change** but moved into a strategy.
    The provided other strategies are, more or less, only result filter around the result of the default version range strategy.
    
    These changes are only placed in _maven-aether-provider_.
    
    ----
    
    The original ```DefaultVersionRangeResolver``` will be replaced by the
    new strategy pattern based version range resolver.
    
    The actual version range resolving algorithm, formerly located in
    ```DefaultVersionRangeResolver```, is moved into a new strategy class
    ```MavenDefaultVersionRangeResolver``` with the name/hint ```"mavenDefault"```.
    The resolving algorithm **WAS NOT CHANGED**.
    
    The new ```StrategyVersionRangeResolver``` will be registered as new
    default version range resolver (without name/hint).
    Additional strategies are registered as ```VersionRangeResolver``` with a
    unique name/hint.
    
    The used strategy will be configured in ```StrategyVersionRangeResolver```
    via the Maven system parameter ```-Dmaven.versionRangeResolver.strategy=...```.
    
    If no strategy is configured or the strategy is unknown, the Maven
    default version range resolver ```"mavenDefault"``` will be used.
    Otherwise the named strategy will be used.
    
    The following strategies are available:
    * ```MavenDefaultVersionRangeResolver``` ```"mavenDefault"```
     * the actual UNTOUCHED default
     * resolves all versions including all _SNAPSHOT_ versions.
    * ```ReleaseOnBoundariesVersionRangeResolver``` ```"releaseOnBoundaries"```
     * Used the ```MavenDefaultVersionRangeResolver``` internally and filters
    the result. Removes all SNAPSHOT versions at the begin and the end of
    the resolved versions list until to a released version.
    * ```OnlyReleaseVersionRangeResolver``` ```"onlyReleases"```
     * Used the ```MavenDefaultVersionRangeResolver``` internally and filters
    the result. Removes all SNAPSHOT versions at the resolved versions list.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/barthel/maven MNG-3092

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/maven/pull/57.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #57
    
----
commit c7454d1a3275ba865e010d0fc016b711450907fb
Author: barthel <ba...@users.noreply.github.com>
Date:   2015-04-30T12:37:52Z

    MNG-3092: Add basic tests for DefaultVersionRangeResolver.

commit bc45cb41d1e7651f537304bdce2a7f82fcaa9215
Author: barthel <ba...@users.noreply.github.com>
Date:   2015-07-02T22:06:00Z

    MNG-3092: Add strategy based version range resolver.
    
    The original ```DefaultVersionRangeResolver``` will be replaced by the
    new strategy pattern based version range resolver.
    
    The actual version range resolving algorithm, formerly located in
    ```DefaultVersionRangeResolver```, is moved into a new strategy class
    ```MavenDefaultVersionRangeResolver``` with the name/hint ```"mavenDefault"```.
    The resolving algorithm WAS NOT CHANGED.
    
    The new ```StrategyVersionRangeResolver``` will be registered as new
    default version range resolver (without name/hint).
    Additional strategies are registered as ```VersionRangeResolver``` with a
    unique name/hint.
    
    The used strategy will be configured in ```StrategyVersionRangeResolver```
    via the Maven system parameter ```-Dmaven.versionRangeResolver.strategy=...```.
    
    If no strategy is configured or the strategy is unknown, the Maven
    default version range resolver ```"mavenDefault"``` will be used.
    Otherwise the named strategy will be used.
    
    The following strategies are available:
    * ```MavenDefaultVersionRangeResolver``` ```"mavenDefault"```
    ** the actual UNTOUCHED default
    ** resolves all versions including all _SNAPSHOT_ versions.
    * ```ReleaseOnBoundariesVersionRangeResolver``` ```"releaseOnBoundaries"```
    ** Used the ```MavenDefaultVersionRangeResolver``` internally and filters
    the result. Removes all SNAPSHOT versions at the begin and the end of
    the resolved versions list until to a released version.
    * ```OnlyReleaseVersionRangeResolver``` ```"onlyReleases"```
    ** Used the ```MavenDefaultVersionRangeResolver``` internally and filters
    the result. Removes all SNAPSHOT versions at the resolved versions list.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven pull request: MNG-3092: Add strategy based version range res...

Posted by barthel <gi...@git.apache.org>.
Github user barthel commented on the pull request:

    https://github.com/apache/maven/pull/57#issuecomment-144993151
  
    I closed this pull request and I come back soon with a less invasive filter solution.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven pull request: MNG-3092: Add strategy based version range res...

Posted by ifedorenko <gi...@git.apache.org>.
Github user ifedorenko commented on the pull request:

    https://github.com/apache/maven/pull/57#issuecomment-120415902
  
    What will happen when projects using new/custom version range resolution strategy are deployed to shared repository like Central? Won't this break consumers of project artifacts?
    
    For example, say my project uses odd/even versioning convention to distinguish between developer and stable versions and I implemented custom range resolver to enforce this convention. Since consumers of my project's artifacts will have no knowledge of the versioning scheme I use, they may resolve wrong transitive dependencies.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven pull request: MNG-3092: Add strategy based version range res...

Posted by barthel <gi...@git.apache.org>.
Github user barthel closed the pull request at:

    https://github.com/apache/maven/pull/57


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven pull request: MNG-3092: Add strategy based version range res...

Posted by jvanzyl <gi...@git.apache.org>.
Github user jvanzyl commented on the pull request:

    https://github.com/apache/maven/pull/57#issuecomment-120428315
  
    And so what strategy are you going to implement? I realized you've made it a strategy but that doesn't negate potential for problematic issues. I'm just trying to determine whether what you really want is what we eventually want to move to. Proper semantic versioning in this case.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven pull request: MNG-3092: Add strategy based version range res...

Posted by barthel <gi...@git.apache.org>.
Github user barthel commented on the pull request:

    https://github.com/apache/maven/pull/57#issuecomment-120420443
  
    The `org.eclipse.aether.resolution.VersionRangeRequest` contains the artifact .
    
    If you implement an odd/even version range resolver strategy only for your artifact, you have to check the artifact at `VersionRangeRequest` instead.
    
    It is possible to write tests to ensure that only your artifacts are handled by the new strategy and third party artifacts are provided to default version range resolver.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven pull request: MNG-3092: Add strategy based version range res...

Posted by barthel <gi...@git.apache.org>.
Github user barthel commented on the pull request:

    https://github.com/apache/maven/pull/57#issuecomment-120431206
  
    My preferred strategy is to resolve only released versions within a version range (```"onlyReleases"```). If a developer needs a SNAPSHOT version, it is possible to insert the SNAPSHOT version directly without version range.
    But that is my case so I would like to give a more flexible way to react on the needs.
    
    For now it isn't possible to change the strategy in a plugin or something like that. At the first time the strategies shipped with the Maven core (maven-aether-provider) are the only once.
    
    Maybe it is a more clear solution to implement a filter around the hard defined version range resolver. That's what the new strategies internally really are.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org