Skip to main content

[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 collection the dependencies here:

https://github.com/grails/grails-core/blob/master/grails-aether/src/main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/AetherDependencyManager.groovy#L400

And then resolve:

https://github.com/grails/grails-core/blob/master/grails-aether/src/main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/AetherDependencyManager.groovy#L386

Nowhere in this class do I see a custom ArtifactTypeRegistry that would add support for your grails-plugin dependency type. Where is this code that you referred to earlier and how exactly does it look like?

One thing that is certainly wrong is this line where a Maven dependency type is turned into a file extension for the DefaultArtifact instance:

https://github.com/grails/grails-core/blob/master/grails-aether/src/main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/AetherDependencyManager.groovy#L431

If you compare with the code of DefaultArtifactDescriptorReader from the maven-aether-provider, you'll notice that this is the very place where the ArtifactTypeRegistry comes into play, to map the dependency type to artifact extension and classifier (among others).

That said, instead of manually invoking the ModelBuilder and converting Maven dependencies into Aether artifacts, you might want to reuse the DefaultArtifactDescriptorReader to match what Maven itself does. E.g. call repoSystem.readArtifactDescriptorReader() with an Artifact instance like dummy:dummy:pom:1 whose properties contain ArtifactProperties.LOCAL_PATH pointing at your pom.xml.

Besides the actual dependencies, you might also want to pass along the managed dependencies from the POM to the CollectRequest to fully mimic Maven.


Benjamin


Back to the top