[Red Hat JIRA] (SHRINKRES-282) Resolve just a pom.xml
by Paolo Antinori (Jira)
[ https://issues.redhat.com/browse/SHRINKRES-282?page=com.atlassian.jira.pl... ]
Paolo Antinori commented on SHRINKRES-282:
------------------------------------------
This is so old that I don't even remember what I was trying to achieve at that time.
I just wanted to follow up with a pointer in a possible other direction, just to ad the conversation for anyone that might be doing Maven pom manipulation:
The last time I have to perform tasks in this context I have used this other project:
https://release-engineering.github.io/pom-manipulation-ext/guide/plugin-m...
Check it out if it might either be an alternative to the original problem or if it could be an inspiration on how to fix this on Shrinkwrap
> Resolve just a pom.xml
> ----------------------
>
> Key: SHRINKRES-282
> URL: https://issues.redhat.com/browse/SHRINKRES-282
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Affects Versions: 2.2.6
> Reporter: Paolo Antinori
> Priority: Major
>
> What's the correct way to resolve a pom.xml ? My use case is to obtain a BOM.
> {code}
> Maven.resolver().resolve("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom:pom:3.0.0-beta-2").withoutTransitivity().asFile();
> {code}
> {code}
> MavenResolvedArtifact artifact = Maven.resolver().resolve("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom:pom:3.0.0-beta-2").withoutTransitivity()
> .asSingle(MavenResolvedArtifact.class);
> {code}
> they both fail? Am I doing something wrong or is this behavior broken for pom files?
--
This message was sent by Atlassian Jira
(v8.13.1#813001)
5 years, 2 months
[Red Hat JIRA] (SHRINKRES-282) Resolve just a pom.xml
by Max Andersen (Jira)
[ https://issues.redhat.com/browse/SHRINKRES-282?page=com.atlassian.jira.pl... ]
Max Andersen commented on SHRINKRES-282:
----------------------------------------
I had the same need for jbang to be able to add one or more pom's to avoid having to specify versions but just rely on the <dependencyManagement> section.
My current workaround is to patch shrinkwrap to at least temporarily allow downloading bom pom's - see https://github.com/shrinkwrap/resolver/compare/master...jbangdev:allowpom
with that code I can do the following:
{{
System.setProperty("jbang-allowpom", "true"); // big hack to trick shrinkwrap in actually get pom
// location
MavenStrategyStage resolve = resolver.resolve(mc.toCanonicalForm());
pomResolve = resolver.loadPomFromFile(resolve.withoutTransitivity().asSingleFile());
System.getProperties().remove("jbang-allowpom");
}}
what is weird is that when doing loadPomFromFile the session does get the dependencymanagement entries added but if you resolve against resolver those are ignored - dependencyManagement is *only* done if you loadPomFromFile or classpath first. That seems to be too restrictive.
So there are two issues IMO:\
1) for some reason shrinkwrap resolve leaves out forcefully any pom dependencies so you can't even fetch it if you wanted to
2) there should be a way to add to dependency management (i.e. using import scope) and then have additional resolve methods use that.
> Resolve just a pom.xml
> ----------------------
>
> Key: SHRINKRES-282
> URL: https://issues.redhat.com/browse/SHRINKRES-282
> Project: ShrinkWrap Resolvers
> Issue Type: Bug
> Affects Versions: 2.2.6
> Reporter: Paolo Antinori
> Priority: Major
>
> What's the correct way to resolve a pom.xml ? My use case is to obtain a BOM.
> {code}
> Maven.resolver().resolve("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom:pom:3.0.0-beta-2").withoutTransitivity().asFile();
> {code}
> {code}
> MavenResolvedArtifact artifact = Maven.resolver().resolve("org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-bom:pom:3.0.0-beta-2").withoutTransitivity()
> .asSingle(MavenResolvedArtifact.class);
> {code}
> they both fail? Am I doing something wrong or is this behavior broken for pom files?
--
This message was sent by Atlassian Jira
(v8.13.1#813001)
5 years, 2 months