[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-13 Thread Robert Scholte (Jira)


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

Robert Scholte commented on MNG-7185:
-

I'll rename this ticket.

> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-13 Thread Nils Breunese (Jira)


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

Nils Breunese commented on MNG-7185:


Thanks for the explanation. I guess the conclusion is that there is no bug, but 
Javadoc for {{VersionRange#createFromVersionSpec}} doesn't show the syntax for 
a closed range for a single version.

> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-13 Thread Robert Scholte (Jira)


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

Robert Scholte commented on MNG-7185:
-

Let's say you write a library. You add a dependency called 'utils' with a 
recommended version, so without bounderies. At compile time this will be the 
version to be used.
Now there's an application that wants to use this library,  but it also adds 
utils with a different version. This is fine, because the library only 
specified a recommended version. In case library gave utils a version with 
bounderies, the application can only choose a version for utils that fits 
within the specified bounderies.
If 'library' specified {{[1.0.0]}} for utils, that's the only allowed version, 
application cannot change it.


> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-13 Thread Nils Breunese (Jira)


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

Nils Breunese commented on MNG-7185:


I don't really grasp the concept of a version range representing a recommended 
version (what is that used for?), but it looks like {{[1.0.0]}} is the syntax I 
actually wanted to use. This syntax is not mentioned in the Javadoc of 
{{VersionRange#createFromVersionSpec}}, so that might be a good idea to add?



> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-13 Thread Robert Scholte (Jira)


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

Robert Scholte commented on MNG-7185:
-

Indeed, if it is just a recommended value. It doesn't represent a range, so 
{{containsVersion}} will always return {{true}}.

> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-12 Thread Michael Osipov (Jira)


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

Michael Osipov commented on MNG-7185:
-

I can reproduce the test case. Please have a look at 
{{org.apache.maven.artifact.versioning.VersionRangeTest.testContains()}}. It 
describes your test case. I believe the behavior is correct according to the 
implementation while the documentation could be better here, imho. It is a 
{{recommendedVersion}}. As far as I remember this mechanism is used to resolve 
version ranges for dependencies and unless you provide a hard version 
{{[1.0.0]}} a selector can exchange it for another.

[~hboutemy], [~rfscholte], am I wrong here?

> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-12 Thread Michael Osipov (Jira)


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

Michael Osipov commented on MNG-7185:
-

Thanks, I will have a look at it.

> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-12 Thread Nils Breunese (Jira)


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

Nils Breunese commented on MNG-7185:


I've created a small reproduction project: 
https://github.com/breun/maven-version-range-single-version

When running {{mvn test}} I see this:

{code}
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.107 s 
<<< FAILURE! - in VersionRangeTest
[ERROR] range_with_single_version_should_not_contain_another_version  Time 
elapsed: 0.016 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: 

Expecting value to be false but was true
at 
VersionRangeTest.range_with_single_version_should_not_contain_another_version(VersionRangeTest.java:23)

{code}

> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
> Fix For: waiting-for-feedback
>
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (MNG-7185) Single version range should not match other versions

2021-07-12 Thread Michael Osipov (Jira)


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

Michael Osipov commented on MNG-7185:
-

Please show the output.

> Single version range should not match other versions
> 
>
> Key: MNG-7185
> URL: https://issues.apache.org/jira/browse/MNG-7185
> Project: Maven
>  Issue Type: Bug
>Affects Versions: 3.8.1
>Reporter: Nils Breunese
>Priority: Minor
>
> I would expect a version range for a single version to not contain any other 
> versions, but it seems this is not the case, because this test fails on the 
> second assertion:
> {code}
> @Test
> void range_with_single_version_should_not_contain_other_version() {
> VersionRange singleVersionRange = 
> VersionRange.createFromVersionSpec("1.0.0");
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("1.0.0"))).isTrue();
> assertThat(singleVersionRange.containsVersion(new 
> DefaultArtifactVersion("2.0.0"))).isFalse();
> }
> {code}
> Is this a bug, or do I misinterpret what a single version range is? Does 
> {{maven-artifact}} have a concept for a version range that only contains a 
> single version?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)