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

William Leung edited comment on MRESOLVER-98 at 8/27/21, 9:59 AM:
------------------------------------------------------------------

[~michael-o]

for the inconsistent of maven and which this project implements, we have 
give-up using it

for replacement, we wrote a script to parse the {{mvn dependency:resolve}} 
output to resolve the dependencies

ref https://gist.github.com/lwr/6829cefaab2261cec1cc733f6398b9ac

usage
{code}
// preparing for environments
Launcher.setMavenHome(getProject().getProperty("maven.home"));
Resolver.setSettingsFile(getProject().getProperty("maven.settingsFile"));

ResolveOptions options = new ResolveOptions()
// pomFile="foo.pom; bar.pom; foo/**/bar/pom.xml" // multiple files is also 
supported
options.setPomFiles(pomFiles);
// coords="g1:a1:v1 g2:a2:v2!g:a" // multiple coords and exclusion supported
options.setCoords(coords);
// "compile" | "runtime" | "test"
options.setScope(scope);
// if you liked
options.setMavenCliOpts(...);
// if you liked
options.setMavenResolveParams(...);

// for each entry: {key -> "g1:a1:v1:jar", value -> 
"/path/to/.m2/repository/g1/a1/v1/a1-v1.jar"}
Map<String, String> properties = new Resolver().execute(options);
{code}


was (Author: william-leung):
[~michael-o]

for the inconsistent of maven and this project implements, we have give-up 
using it

for replacement, we wrote a script to parse the {{mvn dependency:resolve}} 
output to resolve the dependencies

ref https://gist.github.com/lwr/6829cefaab2261cec1cc733f6398b9ac

usage
{code}
// preparing for environments
Launcher.setMavenHome(getProject().getProperty("maven.home"));
Resolver.setSettingsFile(getProject().getProperty("maven.settingsFile"));

ResolveOptions options = new ResolveOptions()
// pomFile="foo.pom; bar.pom; foo/**/bar/pom.xml" // multiple files is also 
supported
options.setPomFiles(pomFiles);
// coords="g1:a1:v1 g2:a2:v2!g:a" // multiple coords and exclusion supported
options.setCoords(coords);
// "compile" | "runtime" | "test"
options.setScope(scope);
// if you liked
options.setMavenCliOpts(...);
// if you liked
options.setMavenResolveParams(...);

// for each entry: {key -> "g1:a1:v1:jar", value -> 
"/path/to/.m2/repository/g1/a1/v1/a1-v1.jar"}
Map<String, String> properties = new Resolver().execute(options);
{code}

> resolver ant task doesn't appear to obey dependencyManagement
> -------------------------------------------------------------
>
>                 Key: MRESOLVER-98
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-98
>             Project: Maven Resolver
>          Issue Type: Bug
>          Components: Ant Tasks
>    Affects Versions: ant-tasks-1.2.0
>            Reporter: Jay Kahrman
>            Priority: Major
>             Fix For: waiting-for-feedback
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> We have a dependency in our pom which has dependencies that don't specify an 
> upper bound to the version range. To avoid getting different versions in 
> every build we use a dependencyManagement section in the POM to lock down the 
> version. This works via the maven 3 CLI, and via the old ant-tasks utility we 
> were using (). The maven-resolver-ant-tasks jar doesn't appear to obey the 
> dependencyManagement section, however. 
>  
> I'm not sure is this is related to MRESOLVER-33 and/or MRESOLVER-10 and if 
> updating maven-resolver-ant-tasks to depend on Maven Resolver 1.4.0 would 
> solve the problem.
>  



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

Reply via email to