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




On Fri, Sep 6, 2013 at 1:25 PM, Benjamin Bentmann <bentmann@xxxxxxxxxxxx> wrote:
Graeme Rocher wrote:

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

And what about other code spots that might follow the same anti-pattern? E.g. https://github.com/grails/grails-core/blob/master/grails-aether/src/main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/AetherDependencyManager.groovy#L514, does dependency.pattern actually refer to file extensions or dependency types like a Maven POM?

And if readPom is false for the troublesome case, where exactly are the dependencies for the CollecRequest constructed from? The ArtifactTypeRegistry is used by the repo system when it processes POMs, any artifact instances one passes in as request parameters are left as-is and are expected to specify the actual file extension.

Sorry for only coming back to this old thread now, been sucked into other things. We have our own dependency definition DSL that is built on Aether APIs, you can see how this works in the tests: 


We don't use Maven to build the dependency model. This is done here:


readPom is only used when a user specifically configures Grails to read a pom.xml file. In the general case the dependencies are built up as above. The trouble some case comes when a dependency has a transitive dependency on a packaging type not known by Aether. When you use Maven you have to specifically tell Maven about these custom packaging types (example https://github.com/grails/grails-maven/blob/master/src/main/resources/META-INF/plexus/components.xml#L32)

I imagine you have to explicitly tell Aether about this types as well. This is what I'm trying to achieve.

 



         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)

As I mentioned before, this code sets a type registry that knows only about your grails-* types and nothing else, in particular, it doesn't support any of the usual Maven types like "ejb-client" or "test-jar".

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:


 

BTW, unless you want to resolve the dependencies of those WARs/ZIPs in addition to the files themselves, you might want to employ the DefaultArtifactType constructor with includesDependencies=true.

Thanks for the tip.

Cheers
 



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