Thursday, June 14, 2007

Specifying your Project's Artifact

The problem:

You want to specify what the output of your Maven project will be.

The solution:

You will set the the artifact type in the section called 'packaging'. This XML element normally exists directly under the root 'project' XML element in your pom. For most maven projects this value will be either jar or war. What you put here will affect what gets created when you type 'mvn package'. There are other plugins that will allow you to use other types of packaging. One is the 'maven-plugin' packaging type, which is used in the project pom for a maven plugin.

You can find more about plugins (and their packaging) here.