Hi,

RepositoryUtils is a utility class, whereas an ArtifactHandler is a Component (i.e. injectable), so these 2 don't mix that well together. IMHO the Artifact is way too big and too complex. It is a mixture of a pojo with component(s), and that's probably also the reason why there was an ArtifactFactory in Maven2 to construct an Artifact. (yes it is still there in Maven3, but deprecated) The way Aether handles artifacts is much better, but since almost every plugin uses the Maven Artifact it is quite impossible to redesign this class.

So one could say it is a bug, but instead I think there's room for improvement (when using custom ArtifactHandlers)

thanks,
Robert

Op Thu, 07 Jan 2016 22:10:17 +0100 schreef Cristiano Gavião <[email protected]>:

After having lost many hours I finally found where the problem is likely
to be... :-(

maven is using aether for dependency resolution, but aether has not a
concept of packaging and extension as maven has. it only has extension.

as a workaround maven is saving the packaging type inside the aether's
DefaultArtifact properties map field. that is ok...

But the values saved in aether's class is not being used properly when
converting again to maven Artifact after resolution.
Instead of searching for an existent ArtifactHandle instance in the
current ArtifactHandlerManager instance a new one is being created in
RepositoryUtils:

org.apache.maven.artifact.Artifact toArtifact( Artifact artifact ){

             ArtifactHandler handler = newHandler( artifact );

-------------------------------------------------------------------------------------

            public static ArtifactHandler newHandler( Artifact artifact )
         {
             String type = artifact.getProperty(
    ArtifactProperties.TYPE, artifact.getExtension() );
*DefaultArtifactHandler handler = new DefaultArtifactHandler( type );*

It is a bug or it was intentionally done this way?


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to