Maven 2 & 3

Custom ArtifactHandler provided by build extension isn't used for project artifact

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.2.0
  • Fix Version/s: 2.2.1
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

If I reference a build extension which provides a custom ArtifactHandler, then set the packaging for the project so that it should use the custom ArtifactHandler when it installs, I find that a default on-demand ArtifactHandler is used instead.

Looking at this more closely, it appears that ArtifactHandlers brought in by extensions (NOT plugins with extensions == true) are never registered with the already-loaded ArtifactHandlerManager. Since Maven < 3.0 doesn't support dynamic collections of components which would detect and include the new extension handler, these handlers are never used.

Activity

Hide
Gabriel Dogaru added a comment -

I am using maven 2.2.1 and I have the same problem for a custom ArtifactHandler define by the plugin that provides estensions.
When I use in my mojo @requiresDependencyResolution test and i call projects.artifacts it gets all the artifacts for test(including junit & others) but not my custom artifact type.

Show
Gabriel Dogaru added a comment - I am using maven 2.2.1 and I have the same problem for a custom ArtifactHandler define by the plugin that provides estensions. When I use in my mojo @requiresDependencyResolution test and i call projects.artifacts it gets all the artifacts for test(including junit & others) but not my custom artifact type.
Hide
John Casey added a comment - - edited

You have to set <extensions>true</extensions> on the plugin that provides the artifact handler, or it won't be loaded.

If you're still experiencing the problem with extensions enabled, please see if you can provide a failing test case so we can verify/track down the problem and fix it.

Show
John Casey added a comment - - edited You have to set <extensions>true</extensions> on the plugin that provides the artifact handler, or it won't be loaded. If you're still experiencing the problem with extensions enabled, please see if you can provide a failing test case so we can verify/track down the problem and fix it.
Hide
Gabriel Dogaru added a comment -

I am using <extensions>true</extensions>.

This happens if I use @requiresDependencyResolution test and my dependency has test scope. If I use compile for the dependency scope the artifact appears in the list of projects artifacts.

Show
Gabriel Dogaru added a comment - I am using <extensions>true</extensions>. This happens if I use @requiresDependencyResolution test and my dependency has test scope. If I use compile for the dependency scope the artifact appears in the list of projects artifacts.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: