Re: Maven plugin development: Getting a Set<Artifact> of an declared and transitive dependencies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin development: Getting a Set<Artifact> of an declared and transitive dependencies

Romain Manni-Bucau
Hi,

GetArtifacts should work if you run it in the right phase.

Le lun. 16 juil. 2018 21:19, [hidden email] <[hidden email]> a
écrit :

> Hey guys,
>
> Right now, I'm doing the following:
>
> ```
> ...
>   @Inject
>   private ProjectDependenciesResolver projectDependenciesResolver;
> ...
>   final List<String> scopes = Arrays.asList(new String[] { "compile",
> "runtime", "test" });
>   final Set<Artifact> artifacts =
> projectDependenciesResolver.resolve(mavenProject, scopes, mavenSession);
> ..
> ```
>
> However, `ProjectDependenciesResolver` is deprecated. Is there a proper
> alternative with the same functionality? `mavenProject.getArtifacts()` does
> not work, it just gives an empty list.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Maven plugin development: Getting a Set&lt;Artifact> of an declared and transitive dependencies

exabrial@gmail.com

Thank you Robert! That fixed the issue with getArticats(). I didn't see that option beforehand.

On 2018/07/16 19:44:36, "Robert Scholte" <[hidden email]> wrote:

> See  
> https://maven.apache.org/plugin-tools/maven-plugin-tools-annotations/index.html
>
> if you want the jars, set requiresDependencyResolution
>
> thanks,
> Robert
>
> On Mon, 16 Jul 2018 21:40:18 +0200, Romain Manni-Bucau  
> <[hidden email]> wrote:
>
> > Hi,
> >
> > GetArtifacts should work if you run it in the right phase.
> >
> > Le lun. 16 juil. 2018 21:19, [hidden email] <[hidden email]> a
> > écrit :
> >
> >> Hey guys,
> >>
> >> Right now, I'm doing the following:
> >>
> >> ```
> >> ...
> >>   @Inject
> >>   private ProjectDependenciesResolver projectDependenciesResolver;
> >> ...
> >>   final List<String> scopes = Arrays.asList(new String[] { "compile",
> >> "runtime", "test" });
> >>   final Set<Artifact> artifacts =
> >> projectDependenciesResolver.resolve(mavenProject, scopes, mavenSession);
> >> ..
> >> ```
> >>
> >> However, `ProjectDependenciesResolver` is deprecated. Is there a proper
> >> alternative with the same functionality? `mavenProject.getArtifacts()`  
> >> does
> >> not work, it just gives an empty list.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]