Continuing the discussion from Reading Maven POM metadata with ShrinkWrap Resolver:
Similar https://issues.jboss.org/browse/SHRINKRES-218
The wish to support more then just resolving Artifact(jar, war, etc) via the ShrinkWrap Resolver API’s keep popping up… With the current API’s it’s only semi possible and fairly hackish.
Internally today we have the ParsedPomFile which wraps the Maven Model.
- The ParsedPomFile is a API interface
- Not available in an exposed interface in the chain only via casting
- Only expose parts of the Maven Model
- No direct access to the Maven Model
In my mind, it sounds like to resolve the artifact or the metadata will reuse 99% of the configuration etc so I don’t think we need a new top level like Maven.metadata() or similar. And I think we want to be able to resolve multiple or single and off different type of objects as we do when resolving Artifacts.
One possible option would be to add a metadata chain to the same level as resolve so we get something like:
File f = Maven.resolver()
.resolve("org.wildfly:wildfly-dist:zip:8.2.0.Final")
.withoutTransitivity()
.asSingleFile();
ParsedPomFile f = Maven.resolver()
.resolveMetadata("org.wildfly:wildfly-dist:zip:8.2.0.Final")
.withoutTransitivity()
.asParsedPomFile();
Model f = Maven.resolver()
.resolveMetadata("org.wildfly:wildfly-dist:zip:8.2.0.Final")
.withoutTransitivity()
.asSingle(Model.class);
Model f = Maven.resolver()
.resolveMetadata("org.wildfly:wildfly-dist:pom:8.2.0.Final")
.withoutTransitivity()
.asSingle(Model.class);
List<Model> f = Maven.resolver()
.resolveMetadata("org.wildfly:wildfly-dist:zip:8.2.0.Final")
.as(Model.class);
- I think using PackagingType zip|jar|war or pom in the resolveMetadata method should all work the same, just rewrite to pom
Any better API solutions?