java - Get all the dependencies of a MavenProject (including transitive ones) using Aether -


how can dependencies of mavenproject (including transitive ones) using aether?

i have seen numerous examples specify gav , resolves artifact , it's dependencies. fine. however, if plugin supposed invoked same project dependencies you're trying resolve, not seem work (or perhaps doing wrong). please give me working example of how it?

i have tried example jcabi-aether shown in this post.

try use utility class classpath jcabi-aether:

collection<file> jars = new classpath(   this.getproject(),   new file(this.session.getlocalrepository().getbasedir()),   "test" // scope you're interested in ); 

you list of jars , directories in "test" scope in current maven project plugin in.

if you're interested list of artifacts instead of files, use aether class directly:

aether aether = new aether(this.getproject(), repo); set<artifact> artifacts = new hashset<artifact>(); (artifact dep : this.getproject().getdependencyartifacts()) {   artifacts.addall(aether.resolve(dep, javascopes.compile)); } 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -