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

So by default readPom is 'false' so the code, flawed or not, doesn't come into play in my case.

You don't see the custom ArtifactTypeRegistry because I haven't committed anything yet as I haven't found a working solution. What I tried was to add the code

        final artifactTypeRegistry = new DefaultArtifactTypeRegistry()
        artifactTypeRegistry.add(new DefaultArtifactType('grails-plugin', 'zip', '', 'none'))
        artifactTypeRegistry.add(new DefaultArtifactType('grails-app', 'war', '', 'none'))
        artifactTypeRegistry.add(new DefaultArtifactType('grails-binary-plugin', 'war', '', 'none'))
        session.setArtifactTypeRegistry(artifactTypeRegistry)

After line 411:


So that when Aether finds a POM with a packaging type of 'grails-plugin' it resolves it as a 'zip' file. At least that is what I was trying to achieve.



On Wed, Sep 4, 2013 at 3:50 PM, Benjamin Bentmann <bentmann@xxxxxxxxxxxx> wrote:
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
_______________________________________________
aether-users mailing list
aether-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aether-users



--
Graeme Rocher
Grails Project Lead
SpringSource

Back to the top