resolve will resolve all the dependencies of the Artifact as well, and you can add them directly to the Archive. e.g.
WebArchive war = ShrinkWrap.create(WebArchive.class).addAsLibraries( DependencyResolvers.use(MavenDependencyResolver.class) .artifact("org.apache.maven.plugins:maven-compiler-plugin:2.3.2") .resolveAs(GenericArchive.class));
As an aside, I think I finally figured out what was bothering me with this API, and it wasn't until I saw Juergen's question that this becme apparent why.
"Resolve" to me does not imply dependencies. "I want a Maven Coordinate, gimme it", is what I think when I see "resolve".
"Resolve With Dependencies" I think describes what we currently have.
So what do we think of:
<T extends Archive<T>> Iterable<T> MavenDependencyResolver.resolveWithDependenciesAs(T type); <T extends Archive<T>> T MavenDependencyResolver.resolveAs(T type);
I've been waiting for this feature for a long time... Maybe it's time for me to help implement it
Andrew would you like to create an issue with this info and assign it to me?
The feature was added in the latest Alpha12 release
But tweaking the API is up for grabs..
I've been following SHRINKWRAP-140 for some time
I purpose to implement what Andrew suggested:
<T extends Archive<T>> Collection<T> MavenDependencyResolver.resolveWithDependenciesAs(T type); <T extends Archive<T>> T MavenDependencyResolver.resolveAs(T type);
And also a shorthand as requested by Nicklas at https://issues.jboss.org/browse/SHRINKWRAP-261.
Thinking about something like MavenArtifact.resolve("joda-time:joda-time:1.6") which returns a GenericArchive.
I should implement it later this week if it's ok with both of you.
Great to see you've taken these.
Let's see a proposal for SHRINKWRAP-261 before you dig in there, though? I like to run all API changes through the wider community. I think what we have in SHRINKWRAP-265 makes sense now.
First of all, I'd like to thank you for your really nice work!
For the new project, we are switching from the old cactus test framework to arquilllian and shrinkwrap. Cool!
The problen we have is related to this discussion. We don't know exactly how to load maven archives. According Aslak's proposal, we are able to optain the archive but it is not complete. The META-INF information are not present.
The code snippet is:
ResourceAdapterArchive qfjJca = ShrinkWrap.create(ResourceAdapterArchive.class, "jca-qfj-adapter-sti-1_19-22.214.171.124.rar")
.configureFrom(System.getenv().get("M2_HOME") + "/conf/settings.xml")
Note that without 'configureFrom' our local repository is not found.
Here is what the get:
Here is what we should get:
At the moment, we load this resource archive via zip importer.
Do you have an idea, what we have to change?
Thanks a lot Ralf