Hello,

I'm facing a problem with a plugin that has a custom ArtifactHandler for a custom packaging type. The custom class is being registered by sisu and no problem was reported while running a build, except when a project artifact has one artifact of this custom type as a dependency.

The problem is that maven is using the DefaultArtifactHandler for the dependency and not the custom one and then I'm getting a ClassCastException in my plugin.

This is how I declared the custom ArtifactHandler. The value of constant is "ip.zip" :

   @Named(CommonMojoConstants.IP_PACKAGING)
   @Singleton
   @Typed(value = { ArtifactHandler.class, ExtendedArtifactHandler.class })
   public class IpArtifactHandler extends AbstractTypeHandler {

        @Inject
        public IpArtifactHandler() {
            super(CommonMojoConstants.IP_PACKAGING);
            setIncludesDependencies(true);
            setExtension(CommonMojoConstants.IP_EXTENSION);
            setLanguage(CommonMojoConstants.LANGUAGE_JAVA);
            setAddedToClasspath(true);
        }

I added a log to try understand what is happen before exception occur.

   [WARN]
   CONVERTING:org.apache.maven.artifact.handler.DefaultArtifactHandler
   | distribution.ip.node

The interesting thing is that I have another custom ArtifactHandler and it is working well. the unique relevant difference between both is the type name. one has a dot and the other just a single word: "bundle":

   [WARN]
   CONVERTING:org.lunifera.maven.lib.mojo.handlers.BundleArtifactHandler |
   org.apache.felix.scr


I want to investigate if the dot is the culprit. Could someone tell me which class is responsible to set the ArtifactHandler for a dependency object ?

thanks,

Cristiano

Reply via email to