[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aether-users] Getting Aether to understand packaging types
|
Graeme Rocher wrote:
We have our own dependency definition DSL that is built on Aether
APIs, you can see how this works in the tests:
https://github.com/grails/grails-core/blob/master/grails-aether/src/test/groovy/org/codehaus/groovy/grails/resolve/maven/AetherDependencyManagerSpec.groovy#L35
We don't use Maven to build the dependency model. This is done here:
https://github.com/grails/grails-core/blob/master/grails-aether/src/main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/config/DependenciesConfiguration.groovy#L121
Just be sure to understand that
new DefaultArtifact(pattern)
gets the file extension directly from the pattern, no magic. If you want
to pass in patterns like foo:bar:grails-plugin:1.0 and expect resolution
to look out for a zip extension instead of "grails-plugin", this is not
the constructor you want. Instead, you would want to consult your
artifact type registry and call something like
new DefaultArtifact(groupId, artifactId, null, null, version,
lookedUpArtifactType)
I imagine you have to explicitly tell Aether about this types as well.
Correct. Maven's artifact handlers translate to ArtifactTypes in Aether.
So I guess that is my question. How do you construct a type registry that
knows about all of the usual Maven types, but also knows about my custom
types as defined here:
https://github.com/grails/grails-maven/blob/master/src/main/resources/META-INF/plexus/components.xml#L32
Have a look at the OverlayTypeRegistry [0]. You could use an instance of
that which delegates to the default registry you get on the session
after calling MavenRepositorySystemUtils, populate it with your types
and then set that on your session going forward.
Benjamin
[0]
http://download.eclipse.org/aether/aether-core/0.9.0.M3/apidocs/org/eclipse/aether/util/artifact/OverlayArtifactTypeRegistry.html