How Maven handles unknown artifact types

Artifact types are specified using the type element on dependencies:


The list of artifact types defined by default can be found in the Maven documentation under Default Artifact Handlers Reference or directly in the source code. Maven plug-ins can define additional artifact types. To use a custom artifact type in a given project, the plug-in defining that artifact type must be added to the POM with extensions set to true:


The interesting question is how Maven handles undefined artifact types. The answer is dictated by the following piece of code in DefaultArtifactHandlerManager:

handler = artifactHandlers.get( type );

if ( handler == null )
    handler = new DefaultArtifactHandler( type );

This means that Maven will not complaining about unknown artifact types. Instead it will generate artifact handlers as required. A look at DefaultArtifactHandler allows us to determine what will be the properties used by these handlers:

  • extension = type
  • packaging = type
  • classifier = null
  • language = "none"
  • addedToClasspath = false
  • includesDependencies = false