Re: API to resolve a version range artifact
Thanks for the compliments! It took quite some time to get it to the current state and we're still not ready, but this confirms it was worth working on and that we should continue its development. Robert ps. I'm glad that Karl Heinz and Guillaume also dared to touch this code. On Sat, 31 Dec 2016 14:49:06 +0100, Dan Tranwrote: I am able to construct Dependency from my Artifact's GAV, maven-artifact-transfer's DependencyResolver handles the rest. Thanks to Robert's excellent works under maven-artifact-transfer -Dan On Wed, Dec 28, 2016 at 2:17 AM, Robert Scholte wrote: Well, you can go from dependency to artifact to file, but not the other way around. If you want to go from artifact to dependency, then the artifact should have been a dependency from the beginning. I've tried to make the difference more clear on the comparison page[1]. While integrating maven-artifact-transfer in several plugins I noticed that quite a lot were using artifacts where actually dependencies should have been used. I've managed to refactor all these cases by using dependencies instead. Be aware that the o.a.m.a.Artifact[2] is a confusing interface, it has way too much methods which actually belong to the dependency. Robert [1] http://maven.apache.org/shared/maven-artifact-transfer/comparison.html [2] http://maven.apache.org/ref/3.3.9/maven-artifact/apidocs/org /apache/maven/artifact/Artifact.html On Wed, 28 Dec 2016 10:01:17 +0100, Dan Tran wrote: is there a component to convert and Artifact to Dependency? Thanks -D On Tue, Dec 27, 2016 at 3:31 PM, Dan Tran wrote: Bingo, it works. I will close to Jira Thanks Robert -Dan On Tue, Dec 27, 2016 at 1:01 PM, Robert Scholte wrote: Just to be sure: buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath ); do you pick up the new buildingRequest? This is required due to immutable instances inside buildingRequest. IIRC I've already applied this to the maven-invoker-plugin, which also needs its own localRepository. Robert On Tue, 27 Dec 2016 05:30:43 +0100, Dan Tran wrote: Thanks, Robert, I am going to switch to DependencyResolver for my use case I also filed https://issues.apache.org/jira/browse/MSHARED-604. Let me know if it is valid, so I can work on the fix Thanks -Dan On Mon, Dec 26, 2016 at 2:53 AM, Robert Scholte wrote: Hi, we must be clear about the naming: an artifact can never have a version range; it is a maven coordinate which results in one file. However, a dependency can have a version range, that's the proper way to get the range resolved and get the matching artifact. Robert On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran wrote: to elaborate my use case: where i started with maven GAV as string, convert to maven artifact, and finally resolve with option to change local repo path Thanks -Dan On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran wrote: Thanks, I am able to obtain ProjectBuildingRequest either with MavenSession or MavenProject, however, there are 2 issues 1. version range does not work, stepping the debugger show no sign of processing resolveVersionRanges flag. and aether throws exception 2. Looks like ProjectBuildingRequest is immutable, i cant override localRepository as resolve time. I can do so with ArtifactResolver from maven-compat Thanks -Dan On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué wrote: If you're inside a Maven plugin, you can get a ProjectBuildingRequest with the session. https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap ache/maven/execution/MavenSession.html#getProjectBuildingRequest() The shared ArtifactResolver from maven-artifact-transfer should resolve version ranges, yes. Le 26/12/2016 à 03:59, Dan Tran a écrit : I found org.apache.maven.shared.artifact.resolve.ArtifactResolver with input of ProjectBuildingRequest here is how I construct the request ProjectBuildingRequest req = new DefaultProjectBuildingRequest(); req.setLocalRepository(localRepository); req.setRemoteRepositories(remoteRepositories); req.setResolveVersionRanges(true); req.setRepositorySession(???);//fixme I have access to both local and remote repos instances, How do I obtain a repositorySession? Thanks -Dan On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: Hi Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan --- L'absence
Re: API to resolve a version range artifact
I am able to construct Dependency from my Artifact's GAV, maven-artifact-transfer's DependencyResolver handles the rest. Thanks to Robert's excellent works under maven-artifact-transfer -Dan On Wed, Dec 28, 2016 at 2:17 AM, Robert Scholtewrote: > Well, you can go from dependency to artifact to file, but not the other > way around. If you want to go from artifact to dependency, then the > artifact should have been a dependency from the beginning. I've tried to > make the difference more clear on the comparison page[1]. > While integrating maven-artifact-transfer in several plugins I noticed > that quite a lot were using artifacts where actually dependencies should > have been used. I've managed to refactor all these cases by using > dependencies instead. > > Be aware that the o.a.m.a.Artifact[2] is a confusing interface, it has way > too much methods which actually belong to the dependency. > > Robert > > [1] http://maven.apache.org/shared/maven-artifact-transfer/comparison.html > [2] http://maven.apache.org/ref/3.3.9/maven-artifact/apidocs/org > /apache/maven/artifact/Artifact.html > > On Wed, 28 Dec 2016 10:01:17 +0100, Dan Tran wrote: > > is there a component to convert and Artifact to Dependency? >> >> Thanks >> >> -D >> >> On Tue, Dec 27, 2016 at 3:31 PM, Dan Tran wrote: >> >> Bingo, it works. I will close to Jira >>> >>> Thanks Robert >>> >>> -Dan >>> >>> On Tue, Dec 27, 2016 at 1:01 PM, Robert Scholte >>> wrote: >>> >>> Just to be sure: buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath ); do you pick up the new buildingRequest? This is required due to immutable instances inside buildingRequest. IIRC I've already applied this to the maven-invoker-plugin, which also needs its own localRepository. Robert On Tue, 27 Dec 2016 05:30:43 +0100, Dan Tran wrote: Thanks, Robert, > > I am going to switch to DependencyResolver for my use case > > I also filed https://issues.apache.org/jira/browse/MSHARED-604. Let me > know > if it is valid, so I can work on the fix > > Thanks > > -Dan > > > > On Mon, Dec 26, 2016 at 2:53 AM, Robert Scholte > wrote: > > Hi, > >> >> we must be clear about the naming: an artifact can never have a >> version >> range; it is a maven coordinate which results in one file. >> However, a dependency can have a version range, that's the proper way >> to >> get the range resolved and get the matching artifact. >> >> Robert >> >> >> >> On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran >> wrote: >> >> to elaborate my use case: where i started with maven GAV as string, >> >> convert to maven artifact, and finally resolve with option to change >>> local >>> repo path >>> >>> Thanks >>> >>> -Dan >>> >>> On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran >>> wrote: >>> >>> Thanks, I am able to obtain ProjectBuildingRequest either with >>> >>> MavenSession or MavenProject, however, there are 2 issues 1. version range does not work, stepping the debugger show no sign of processing resolveVersionRanges flag. and aether throws exception 2. Looks like ProjectBuildingRequest is immutable, i cant override localRepository as resolve time. I can do so with ArtifactResolver from maven-compat Thanks -Dan On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué wrote: If you're inside a Maven plugin, you can get a ProjectBuildingRequest with the session. > > https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap > ache/maven/execution/MavenSession.html#getProjectBuildingRequest() > > The shared ArtifactResolver from maven-artifact-transfer should > resolve > version ranges, yes. > > > > Le 26/12/2016 à 03:59, Dan Tran a écrit : > > I found org.apache.maven.shared.artifact.resolve.ArtifactResolver > > with >> input of ProjectBuildingRequest >> >> here is how I construct the request >> >> ProjectBuildingRequest req = new >> DefaultProjectBuildingRequest(); >> req.setLocalRepository(localRepository); >> req.setRemoteRepositories(remoteRepositories); >> req.setResolveVersionRanges(true); >> req.setRepositorySession(???);//fixme >> >>
Re: API to resolve a version range artifact
Well, you can go from dependency to artifact to file, but not the other way around. If you want to go from artifact to dependency, then the artifact should have been a dependency from the beginning. I've tried to make the difference more clear on the comparison page[1]. While integrating maven-artifact-transfer in several plugins I noticed that quite a lot were using artifacts where actually dependencies should have been used. I've managed to refactor all these cases by using dependencies instead. Be aware that the o.a.m.a.Artifact[2] is a confusing interface, it has way too much methods which actually belong to the dependency. Robert [1] http://maven.apache.org/shared/maven-artifact-transfer/comparison.html [2] http://maven.apache.org/ref/3.3.9/maven-artifact/apidocs/org/apache/maven/artifact/Artifact.html On Wed, 28 Dec 2016 10:01:17 +0100, Dan Tranwrote: is there a component to convert and Artifact to Dependency? Thanks -D On Tue, Dec 27, 2016 at 3:31 PM, Dan Tran wrote: Bingo, it works. I will close to Jira Thanks Robert -Dan On Tue, Dec 27, 2016 at 1:01 PM, Robert Scholte wrote: Just to be sure: buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath ); do you pick up the new buildingRequest? This is required due to immutable instances inside buildingRequest. IIRC I've already applied this to the maven-invoker-plugin, which also needs its own localRepository. Robert On Tue, 27 Dec 2016 05:30:43 +0100, Dan Tran wrote: Thanks, Robert, I am going to switch to DependencyResolver for my use case I also filed https://issues.apache.org/jira/browse/MSHARED-604. Let me know if it is valid, so I can work on the fix Thanks -Dan On Mon, Dec 26, 2016 at 2:53 AM, Robert Scholte wrote: Hi, we must be clear about the naming: an artifact can never have a version range; it is a maven coordinate which results in one file. However, a dependency can have a version range, that's the proper way to get the range resolved and get the matching artifact. Robert On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran wrote: to elaborate my use case: where i started with maven GAV as string, convert to maven artifact, and finally resolve with option to change local repo path Thanks -Dan On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran wrote: Thanks, I am able to obtain ProjectBuildingRequest either with MavenSession or MavenProject, however, there are 2 issues 1. version range does not work, stepping the debugger show no sign of processing resolveVersionRanges flag. and aether throws exception 2. Looks like ProjectBuildingRequest is immutable, i cant override localRepository as resolve time. I can do so with ArtifactResolver from maven-compat Thanks -Dan On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué wrote: If you're inside a Maven plugin, you can get a ProjectBuildingRequest with the session. https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap ache/maven/execution/MavenSession.html#getProjectBuildingRequest() The shared ArtifactResolver from maven-artifact-transfer should resolve version ranges, yes. Le 26/12/2016 à 03:59, Dan Tran a écrit : I found org.apache.maven.shared.artifact.resolve.ArtifactResolver with input of ProjectBuildingRequest here is how I construct the request ProjectBuildingRequest req = new DefaultProjectBuildingRequest(); req.setLocalRepository(localRepository); req.setRemoteRepositories(remoteRepositories); req.setResolveVersionRanges(true); req.setRepositorySession(???);//fixme I have access to both local and remote repos instances, How do I obtain a repositorySession? Thanks -Dan On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: Hi Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail:
Re: API to resolve a version range artifact
is there a component to convert and Artifact to Dependency? Thanks -D On Tue, Dec 27, 2016 at 3:31 PM, Dan Tranwrote: > Bingo, it works. I will close to Jira > > Thanks Robert > > -Dan > > On Tue, Dec 27, 2016 at 1:01 PM, Robert Scholte > wrote: > >> Just to be sure: >> >> buildingRequest = repositoryManager.setLocalRepositoryBasedir( >> buildingRequest, localRepositoryPath ); >> >> do you pick up the new buildingRequest? This is required due to immutable >> instances inside buildingRequest. >> IIRC I've already applied this to the maven-invoker-plugin, which also >> needs its own localRepository. >> >> Robert >> >> >> On Tue, 27 Dec 2016 05:30:43 +0100, Dan Tran wrote: >> >> Thanks, Robert, >>> >>> I am going to switch to DependencyResolver for my use case >>> >>> I also filed https://issues.apache.org/jira/browse/MSHARED-604. Let me >>> know >>> if it is valid, so I can work on the fix >>> >>> Thanks >>> >>> -Dan >>> >>> >>> >>> On Mon, Dec 26, 2016 at 2:53 AM, Robert Scholte >>> wrote: >>> >>> Hi, we must be clear about the naming: an artifact can never have a version range; it is a maven coordinate which results in one file. However, a dependency can have a version range, that's the proper way to get the range resolved and get the matching artifact. Robert On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran wrote: to elaborate my use case: where i started with maven GAV as string, > convert to maven artifact, and finally resolve with option to change > local > repo path > > Thanks > > -Dan > > On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran wrote: > > Thanks, I am able to obtain ProjectBuildingRequest either with > >> MavenSession or MavenProject, however, there are 2 issues >> >> 1. version range does not work, stepping the debugger show no sign >> of >> processing resolveVersionRanges flag. and aether throws exception >> >> 2. Looks like ProjectBuildingRequest is immutable, i cant override >> localRepository as resolve time. I can do so with ArtifactResolver >> from >> maven-compat >> >> >> Thanks >> >> -Dan >> >> On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué >> wrote: >> >> If you're inside a Maven plugin, you can get a ProjectBuildingRequest >> >>> with the session. >>> >>> https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap >>> ache/maven/execution/MavenSession.html#getProjectBuildingRequest() >>> >>> The shared ArtifactResolver from maven-artifact-transfer should >>> resolve >>> version ranges, yes. >>> >>> >>> >>> Le 26/12/2016 à 03:59, Dan Tran a écrit : >>> >>> I found org.apache.maven.shared.artifact.resolve.ArtifactResolver >>> with input of ProjectBuildingRequest here is how I construct the request ProjectBuildingRequest req = new DefaultProjectBuildingRequest(); req.setLocalRepository(localRepository); req.setRemoteRepositories(remoteRepositories); req.setResolveVersionRanges(true); req.setRepositorySession(???);//fixme I have access to both local and remote repos instances, How do I obtain a repositorySession? Thanks -Dan On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: Hi > Does maven-artifact-transfer have this feature? if so which api? > > basically, I have an org.apache.maven.artifact.Artifact with > version > range set. I need to resolve it to pickup the matching version > available > at maven repo > > the org.apache.maven.artifact.resolver.ArtifactResolver from > maven-compat cant resolve it > > > Thanks > > -Dan > > > > --- >>> L'absence de virus dans ce courrier électronique a été vérifiée par >>> le >>> logiciel antivirus Avast. >>> https://www.avast.com/antivirus >>> >>> >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >>> For additional commands, e-mail: users-h...@maven.apache.org >>> >>> >>> >>> - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org >>
Re: API to resolve a version range artifact
Bingo, it works. I will close to Jira Thanks Robert -Dan On Tue, Dec 27, 2016 at 1:01 PM, Robert Scholtewrote: > Just to be sure: > > buildingRequest = repositoryManager.setLocalRepositoryBasedir( > buildingRequest, localRepositoryPath ); > > do you pick up the new buildingRequest? This is required due to immutable > instances inside buildingRequest. > IIRC I've already applied this to the maven-invoker-plugin, which also > needs its own localRepository. > > Robert > > > On Tue, 27 Dec 2016 05:30:43 +0100, Dan Tran wrote: > > Thanks, Robert, >> >> I am going to switch to DependencyResolver for my use case >> >> I also filed https://issues.apache.org/jira/browse/MSHARED-604. Let me >> know >> if it is valid, so I can work on the fix >> >> Thanks >> >> -Dan >> >> >> >> On Mon, Dec 26, 2016 at 2:53 AM, Robert Scholte >> wrote: >> >> Hi, >>> >>> we must be clear about the naming: an artifact can never have a version >>> range; it is a maven coordinate which results in one file. >>> However, a dependency can have a version range, that's the proper way to >>> get the range resolved and get the matching artifact. >>> >>> Robert >>> >>> >>> >>> On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran wrote: >>> >>> to elaborate my use case: where i started with maven GAV as string, >>> convert to maven artifact, and finally resolve with option to change local repo path Thanks -Dan On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran wrote: Thanks, I am able to obtain ProjectBuildingRequest either with > MavenSession or MavenProject, however, there are 2 issues > > 1. version range does not work, stepping the debugger show no sign of > processing resolveVersionRanges flag. and aether throws exception > > 2. Looks like ProjectBuildingRequest is immutable, i cant override > localRepository as resolve time. I can do so with ArtifactResolver from > maven-compat > > > Thanks > > -Dan > > On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué > wrote: > > If you're inside a Maven plugin, you can get a ProjectBuildingRequest > >> with the session. >> >> https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap >> ache/maven/execution/MavenSession.html#getProjectBuildingRequest() >> >> The shared ArtifactResolver from maven-artifact-transfer should >> resolve >> version ranges, yes. >> >> >> >> Le 26/12/2016 à 03:59, Dan Tran a écrit : >> >> I found org.apache.maven.shared.artifact.resolve.ArtifactResolver >> >>> with >>> input of ProjectBuildingRequest >>> >>> here is how I construct the request >>> >>> ProjectBuildingRequest req = new >>> DefaultProjectBuildingRequest(); >>> req.setLocalRepository(localRepository); >>> req.setRemoteRepositories(remoteRepositories); >>> req.setResolveVersionRanges(true); >>> req.setRepositorySession(???);//fixme >>> >>> I have access to both local and remote repos instances, >>> >>> How do I obtain a repositorySession? >>> >>> Thanks >>> >>> -Dan >>> >>> >>> On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran >>> wrote: >>> >>> Hi >>> >>> Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan --- >> L'absence de virus dans ce courrier électronique a été vérifiée par le >> logiciel antivirus Avast. >> https://www.avast.com/antivirus >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> >> >> - >>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >>> For additional commands, e-mail: users-h...@maven.apache.org >>> >>> > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: API to resolve a version range artifact
Just to be sure: buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath ); do you pick up the new buildingRequest? This is required due to immutable instances inside buildingRequest. IIRC I've already applied this to the maven-invoker-plugin, which also needs its own localRepository. Robert On Tue, 27 Dec 2016 05:30:43 +0100, Dan Tranwrote: Thanks, Robert, I am going to switch to DependencyResolver for my use case I also filed https://issues.apache.org/jira/browse/MSHARED-604. Let me know if it is valid, so I can work on the fix Thanks -Dan On Mon, Dec 26, 2016 at 2:53 AM, Robert Scholte wrote: Hi, we must be clear about the naming: an artifact can never have a version range; it is a maven coordinate which results in one file. However, a dependency can have a version range, that's the proper way to get the range resolved and get the matching artifact. Robert On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran wrote: to elaborate my use case: where i started with maven GAV as string, convert to maven artifact, and finally resolve with option to change local repo path Thanks -Dan On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran wrote: Thanks, I am able to obtain ProjectBuildingRequest either with MavenSession or MavenProject, however, there are 2 issues 1. version range does not work, stepping the debugger show no sign of processing resolveVersionRanges flag. and aether throws exception 2. Looks like ProjectBuildingRequest is immutable, i cant override localRepository as resolve time. I can do so with ArtifactResolver from maven-compat Thanks -Dan On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué wrote: If you're inside a Maven plugin, you can get a ProjectBuildingRequest with the session. https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap ache/maven/execution/MavenSession.html#getProjectBuildingRequest() The shared ArtifactResolver from maven-artifact-transfer should resolve version ranges, yes. Le 26/12/2016 à 03:59, Dan Tran a écrit : I found org.apache.maven.shared.artifact.resolve.ArtifactResolver with input of ProjectBuildingRequest here is how I construct the request ProjectBuildingRequest req = new DefaultProjectBuildingRequest(); req.setLocalRepository(localRepository); req.setRemoteRepositories(remoteRepositories); req.setResolveVersionRanges(true); req.setRepositorySession(???);//fixme I have access to both local and remote repos instances, How do I obtain a repositorySession? Thanks -Dan On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: Hi Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: API to resolve a version range artifact
Thanks, Robert, I am going to switch to DependencyResolver for my use case I also filed https://issues.apache.org/jira/browse/MSHARED-604. Let me know if it is valid, so I can work on the fix Thanks -Dan On Mon, Dec 26, 2016 at 2:53 AM, Robert Scholtewrote: > Hi, > > we must be clear about the naming: an artifact can never have a version > range; it is a maven coordinate which results in one file. > However, a dependency can have a version range, that's the proper way to > get the range resolved and get the matching artifact. > > Robert > > > > On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran wrote: > > to elaborate my use case: where i started with maven GAV as string, >> convert to maven artifact, and finally resolve with option to change >> local >> repo path >> >> Thanks >> >> -Dan >> >> On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran wrote: >> >> Thanks, I am able to obtain ProjectBuildingRequest either with >>> MavenSession or MavenProject, however, there are 2 issues >>> >>> 1. version range does not work, stepping the debugger show no sign of >>> processing resolveVersionRanges flag. and aether throws exception >>> >>> 2. Looks like ProjectBuildingRequest is immutable, i cant override >>> localRepository as resolve time. I can do so with ArtifactResolver from >>> maven-compat >>> >>> >>> Thanks >>> >>> -Dan >>> >>> On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué >>> wrote: >>> >>> If you're inside a Maven plugin, you can get a ProjectBuildingRequest with the session. https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap ache/maven/execution/MavenSession.html#getProjectBuildingRequest() The shared ArtifactResolver from maven-artifact-transfer should resolve version ranges, yes. Le 26/12/2016 à 03:59, Dan Tran a écrit : I found org.apache.maven.shared.artifact.resolve.ArtifactResolver > with > input of ProjectBuildingRequest > > here is how I construct the request > > ProjectBuildingRequest req = new > DefaultProjectBuildingRequest(); > req.setLocalRepository(localRepository); > req.setRemoteRepositories(remoteRepositories); > req.setResolveVersionRanges(true); > req.setRepositorySession(???);//fixme > > I have access to both local and remote repos instances, > > How do I obtain a repositorySession? > > Thanks > > -Dan > > > On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: > > Hi > >> >> Does maven-artifact-transfer have this feature? if so which api? >> >> basically, I have an org.apache.maven.artifact.Artifact with version >> range set. I need to resolve it to pickup the matching version >> available >> at maven repo >> >> the org.apache.maven.artifact.resolver.ArtifactResolver from >> maven-compat cant resolve it >> >> >> Thanks >> >> -Dan >> >> >> --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: API to resolve a version range artifact
Hi, we must be clear about the naming: an artifact can never have a version range; it is a maven coordinate which results in one file. However, a dependency can have a version range, that's the proper way to get the range resolved and get the matching artifact. Robert On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tranwrote: to elaborate my use case: where i started with maven GAV as string, convert to maven artifact, and finally resolve with option to change local repo path Thanks -Dan On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran wrote: Thanks, I am able to obtain ProjectBuildingRequest either with MavenSession or MavenProject, however, there are 2 issues 1. version range does not work, stepping the debugger show no sign of processing resolveVersionRanges flag. and aether throws exception 2. Looks like ProjectBuildingRequest is immutable, i cant override localRepository as resolve time. I can do so with ArtifactResolver from maven-compat Thanks -Dan On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué wrote: If you're inside a Maven plugin, you can get a ProjectBuildingRequest with the session. https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap ache/maven/execution/MavenSession.html#getProjectBuildingRequest() The shared ArtifactResolver from maven-artifact-transfer should resolve version ranges, yes. Le 26/12/2016 à 03:59, Dan Tran a écrit : I found org.apache.maven.shared.artifact.resolve.ArtifactResolver with input of ProjectBuildingRequest here is how I construct the request ProjectBuildingRequest req = new DefaultProjectBuildingRequest(); req.setLocalRepository(localRepository); req.setRemoteRepositories(remoteRepositories); req.setResolveVersionRanges(true); req.setRepositorySession(???);//fixme I have access to both local and remote repos instances, How do I obtain a repositorySession? Thanks -Dan On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: Hi Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: API to resolve a version range artifact
to elaborate my use case: where i started with maven GAV as string, convert to maven artifact, and finally resolve with option to change local repo path Thanks -Dan On Sun, Dec 25, 2016 at 11:31 PM, Dan Tranwrote: > Thanks, I am able to obtain ProjectBuildingRequest either with > MavenSession or MavenProject, however, there are 2 issues > > 1. version range does not work, stepping the debugger show no sign of > processing resolveVersionRanges flag. and aether throws exception > > 2. Looks like ProjectBuildingRequest is immutable, i cant override > localRepository as resolve time. I can do so with ArtifactResolver from > maven-compat > > > Thanks > > -Dan > > On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué wrote: > >> If you're inside a Maven plugin, you can get a ProjectBuildingRequest >> with the session. >> >> https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap >> ache/maven/execution/MavenSession.html#getProjectBuildingRequest() >> >> The shared ArtifactResolver from maven-artifact-transfer should resolve >> version ranges, yes. >> >> >> >> Le 26/12/2016 à 03:59, Dan Tran a écrit : >> >>> I found org.apache.maven.shared.artifact.resolve.ArtifactResolver >>> with >>> input of ProjectBuildingRequest >>> >>> here is how I construct the request >>> >>> ProjectBuildingRequest req = new >>> DefaultProjectBuildingRequest(); >>> req.setLocalRepository(localRepository); >>> req.setRemoteRepositories(remoteRepositories); >>> req.setResolveVersionRanges(true); >>> req.setRepositorySession(???);//fixme >>> >>> I have access to both local and remote repos instances, >>> >>> How do I obtain a repositorySession? >>> >>> Thanks >>> >>> -Dan >>> >>> >>> On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: >>> >>> Hi Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan >> >> --- >> L'absence de virus dans ce courrier électronique a été vérifiée par le >> logiciel antivirus Avast. >> https://www.avast.com/antivirus >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> >
Re: API to resolve a version range artifact
Thanks, I am able to obtain ProjectBuildingRequest either with MavenSession or MavenProject, however, there are 2 issues 1. version range does not work, stepping the debugger show no sign of processing resolveVersionRanges flag. and aether throws exception 2. Looks like ProjectBuildingRequest is immutable, i cant override localRepository as resolve time. I can do so with ArtifactResolver from maven-compat Thanks -Dan On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Bouéwrote: > If you're inside a Maven plugin, you can get a ProjectBuildingRequest with > the session. > > https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap > ache/maven/execution/MavenSession.html#getProjectBuildingRequest() > > The shared ArtifactResolver from maven-artifact-transfer should resolve > version ranges, yes. > > > > Le 26/12/2016 à 03:59, Dan Tran a écrit : > >> I found org.apache.maven.shared.artifact.resolve.ArtifactResolver with >> input of ProjectBuildingRequest >> >> here is how I construct the request >> >> ProjectBuildingRequest req = new >> DefaultProjectBuildingRequest(); >> req.setLocalRepository(localRepository); >> req.setRemoteRepositories(remoteRepositories); >> req.setResolveVersionRanges(true); >> req.setRepositorySession(???);//fixme >> >> I have access to both local and remote repos instances, >> >> How do I obtain a repositorySession? >> >> Thanks >> >> -Dan >> >> >> On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran wrote: >> >> Hi >>> >>> Does maven-artifact-transfer have this feature? if so which api? >>> >>> basically, I have an org.apache.maven.artifact.Artifact with version >>> range set. I need to resolve it to pickup the matching version available >>> at maven repo >>> >>> the org.apache.maven.artifact.resolver.ArtifactResolver from >>> maven-compat cant resolve it >>> >>> >>> Thanks >>> >>> -Dan >>> >>> > > --- > L'absence de virus dans ce courrier électronique a été vérifiée par le > logiciel antivirus Avast. > https://www.avast.com/antivirus > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >
Re: API to resolve a version range artifact
If you're inside a Maven plugin, you can get a ProjectBuildingRequest with the session. https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/apache/maven/execution/MavenSession.html#getProjectBuildingRequest() The shared ArtifactResolver from maven-artifact-transfer should resolve version ranges, yes. Le 26/12/2016 à 03:59, Dan Tran a écrit : I found org.apache.maven.shared.artifact.resolve.ArtifactResolver with input of ProjectBuildingRequest here is how I construct the request ProjectBuildingRequest req = new DefaultProjectBuildingRequest(); req.setLocalRepository(localRepository); req.setRemoteRepositories(remoteRepositories); req.setResolveVersionRanges(true); req.setRepositorySession(???);//fixme I have access to both local and remote repos instances, How do I obtain a repositorySession? Thanks -Dan On Sun, Dec 25, 2016 at 10:45 AM, Dan Tranwrote: Hi Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: API to resolve a version range artifact
I found org.apache.maven.shared.artifact.resolve.ArtifactResolver with input of ProjectBuildingRequest here is how I construct the request ProjectBuildingRequest req = new DefaultProjectBuildingRequest(); req.setLocalRepository(localRepository); req.setRemoteRepositories(remoteRepositories); req.setResolveVersionRanges(true); req.setRepositorySession(???);//fixme I have access to both local and remote repos instances, How do I obtain a repositorySession? Thanks -Dan On Sun, Dec 25, 2016 at 10:45 AM, Dan Tranwrote: > > Hi > > Does maven-artifact-transfer have this feature? if so which api? > > basically, I have an org.apache.maven.artifact.Artifact with version > range set. I need to resolve it to pickup the matching version available > at maven repo > > the org.apache.maven.artifact.resolver.ArtifactResolver from > maven-compat cant resolve it > > > Thanks > > -Dan >
API to resolve a version range artifact
Hi Does maven-artifact-transfer have this feature? if so which api? basically, I have an org.apache.maven.artifact.Artifact with version range set. I need to resolve it to pickup the matching version available at maven repo the org.apache.maven.artifact.resolver.ArtifactResolver from maven-compat cant resolve it Thanks -Dan