You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Mavroukakis, Ioannis" <IM...@bgcpartners.com> on 2012/08/09 19:16:29 UTC

VersionRange not used in artifact resolution?

Hello everyone,

I'm worming my way slowly into the weird and wonderful world of maven plugin development, and I was having a play with some of the examples in the cookbook.

My test artifact is version 12.8.14, the range starts at .14 and goes all the way up to .20 and I have an Artifactory instance serving our locally produced artifacts. I'm using the 3.0.4 plugin-api and core.

Given the following snippet

VersionRange versionRange = VersionRange.createFromVersionSpec("(,12.8.14]");

Artifact dependendArtifact = artifactFactory.createDependencyArtifact(localArtifact.getGroupId(),localArtifact.getArtifactId(), versionRange, localArtifact.getType(),localArtifact.getClassifier(), localArtifact.getScope());
List<ArtifactVersion> availableVersions = artifactMetadataSource.retrieveAvailableVersions(dependendArtifact, localRepo, remoteRepositories);

I would expect that availableVersions would contain only 12.8.14. However it returns all the deployed versions available. Going through the resolution source I can see no obvious place where VersionRange is applied...Is my assumption of how this is used flawed?

Thanks for your help,

Ioannis

http://www.bgcpartners.com
CONFIDENTIAL: This e-mail has been sent to you by one of the BGC entities (collectively BGC)
listed at the following link http://www.bgcpartners.com/legal/disclaimers/index.html#email_disclaimer.
The link contains company and FSA registration numbers. This e-mail, including its contents and
attachments, if any, are confidential. If you are not the named recipient please notify the sender and
immediately delete it. You may not disseminate, distribute, or forward this e-mail message or disclose
its contents to anybody else. Copyright and any other intellectual property rights in its contents are the
sole property of BGC and its affiliates. E-mail transmission cannot be guaranteed to be secure or error-free.
The sender therefore does not accept liability for any errors or omissions in the contents of this
message which arise as a result of e-mail transmission.  If verification is required please request a
hard-copy version. Although we routinely screen for viruses, addressees should check this e-mail and any
attachments for viruses. We make no representation or warranty as to the absence of viruses in this
e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our
customers and business, we may monitor and read e-mails sent to and from our server(s). 
The registered offices of the BGC entities are at 1 Churchill Place, London, E14 5RD.  
For any issues arising from this email please reply to the sender. 
The FSA register appears at http://www.fsa.gov.uk/register/.  
The FSA regulates the financial services industry in the United Kingdom and is located at 
25 The North Colonnade, Canary Wharf, London, E14 5HS.

Re: VersionRange not used in artifact resolution?

Posted by Brett Porter <br...@apache.org>.
On 10/08/2012, at 6:53 PM, "Mavroukakis, Ioannis" <IM...@bgcpartners.com> wrote:

> Thanks Brett, will that also apply to what is retrieved from the remote repo?

Yes, that's the main purpose of the resolver - to find the right artifacts on a list of remote repositories, and download them to the local repository (though you don't necessarily need to do the download step).

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
http://twitter.com/brettporter






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


RE: VersionRange not used in artifact resolution?

Posted by "Mavroukakis, Ioannis" <IM...@bgcpartners.com>.
Thanks Brett, will that also apply to what is retrieved from the remote repo?

-----Original Message-----
From: Brett Porter [mailto:brett@porterclan.net] On Behalf Of Brett Porter
Sent: 10 August 2012 01:00
To: Maven Developers List
Subject: Re: VersionRange not used in artifact resolution?



On 10/08/2012, at 3:16 AM, "Mavroukakis, Ioannis" <IM...@bgcpartners.com> wrote:

> Hello everyone,
> 
> I'm worming my way slowly into the weird and wonderful world of maven plugin development, and I was having a play with some of the examples in the cookbook.
> 
> My test artifact is version 12.8.14, the range starts at .14 and goes all the way up to .20 and I have an Artifactory instance serving our locally produced artifacts. I'm using the 3.0.4 plugin-api and core.
> 
> Given the following snippet
> 
> VersionRange versionRange = 
> VersionRange.createFromVersionSpec("(,12.8.14]");
> 
> Artifact dependendArtifact = 
> artifactFactory.createDependencyArtifact(localArtifact.getGroupId(),lo
> calArtifact.getArtifactId(), versionRange, 
> localArtifact.getType(),localArtifact.getClassifier(), 
> localArtifact.getScope()); List<ArtifactVersion> availableVersions = 
> artifactMetadataSource.retrieveAvailableVersions(dependendArtifact, 
> localRepo, remoteRepositories);
> 
> I would expect that availableVersions would contain only 12.8.14. However it returns all the deployed versions available. Going through the resolution source I can see no obvious place where VersionRange is applied...Is my assumption of how this is used flawed?
> 

It's just not used for that particular method call, which looks up the metadata at the artifact level, without filtering.

If you want to constrain versions, you need to use the ArtifactResolver framework.

- Brett


--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
http://twitter.com/brettporter






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

http://www.bgcpartners.com
CONFIDENTIAL: This e-mail has been sent to you by one of the BGC entities (collectively BGC)
listed at the following link http://www.bgcpartners.com/legal/disclaimers/index.html#email_disclaimer.
The link contains company and FSA registration numbers. This e-mail, including its contents and
attachments, if any, are confidential. If you are not the named recipient please notify the sender and
immediately delete it. You may not disseminate, distribute, or forward this e-mail message or disclose
its contents to anybody else. Copyright and any other intellectual property rights in its contents are the
sole property of BGC and its affiliates. E-mail transmission cannot be guaranteed to be secure or error-free.
The sender therefore does not accept liability for any errors or omissions in the contents of this
message which arise as a result of e-mail transmission.  If verification is required please request a
hard-copy version. Although we routinely screen for viruses, addressees should check this e-mail and any
attachments for viruses. We make no representation or warranty as to the absence of viruses in this
e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our
customers and business, we may monitor and read e-mails sent to and from our server(s). 
The registered offices of the BGC entities are at 1 Churchill Place, London, E14 5RD.  
For any issues arising from this email please reply to the sender. 
The FSA register appears at http://www.fsa.gov.uk/register/.  
The FSA regulates the financial services industry in the United Kingdom and is located at 
25 The North Colonnade, Canary Wharf, London, E14 5HS.


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


Re: VersionRange not used in artifact resolution?

Posted by Brett Porter <br...@apache.org>.

On 10/08/2012, at 3:16 AM, "Mavroukakis, Ioannis" <IM...@bgcpartners.com> wrote:

> Hello everyone,
> 
> I'm worming my way slowly into the weird and wonderful world of maven plugin development, and I was having a play with some of the examples in the cookbook.
> 
> My test artifact is version 12.8.14, the range starts at .14 and goes all the way up to .20 and I have an Artifactory instance serving our locally produced artifacts. I'm using the 3.0.4 plugin-api and core.
> 
> Given the following snippet
> 
> VersionRange versionRange = VersionRange.createFromVersionSpec("(,12.8.14]");
> 
> Artifact dependendArtifact = artifactFactory.createDependencyArtifact(localArtifact.getGroupId(),localArtifact.getArtifactId(), versionRange, localArtifact.getType(),localArtifact.getClassifier(), localArtifact.getScope());
> List<ArtifactVersion> availableVersions = artifactMetadataSource.retrieveAvailableVersions(dependendArtifact, localRepo, remoteRepositories);
> 
> I would expect that availableVersions would contain only 12.8.14. However it returns all the deployed versions available. Going through the resolution source I can see no obvious place where VersionRange is applied...Is my assumption of how this is used flawed?
> 

It's just not used for that particular method call, which looks up the metadata at the artifact level, without filtering.

If you want to constrain versions, you need to use the ArtifactResolver framework.

- Brett


--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/
http://au.linkedin.com/in/brettporter
http://twitter.com/brettporter






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