------ Usage ------ Jerome Lacoste Dennis Lundberg Olivier Lamy ------ 2011-08-17 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Usage Some brief examples on how to use this plugin. If you want to use advanced configurations you should have a look at the {{{./index.html#Examples}Example section}}. documentation for {{{http://maven.apache.org/shared/maven-archiver/}Maven Archiver}}. To handle archiving this version of Maven JAR Plugin uses {{{http://maven.apache.org/shared/maven-archiver/index.html}Maven Archiver}} ${mavenArchiverVersion}. <> Originally, this plugin was meant to sign JARs as well. As of version 2.3, the corresponding goals are no longer supported and users are advised to use the dedicated {{{http://maven.apache.org/plugins/maven-jarsigner-plugin/}Maven Jarsigner Plugin}} instead. As of the current version 2.5, the corresponding goals were removed. * How to build a JAR file When you want to create a JAR-file with Maven, you first have to create a <<>>-file with at least the following content: +----------+ 4.0.0 com.mycompany.project core 1.0-SNAPSHOT +----------+ Since 'jar' is the default packaging type it is not required to set it in this case. Apart from the above you will normally want some real java source files which should be located within <<>>. If you need extra resources on your classpath (for example property files) they should be located in <<>>. Now we can create a JAR-file by using the command below: +-----------------+ mvn package +-----------------+ The 'package' phase is always responsible for bundling all the files in the artifact, in this case a JAR-file. In your project's <<>> directory you'll see the generated jar file which is named like: 'core-1.0-SNAPSHOT.jar'. The resulting 'jar' file contains the compiled java class files as well as the files from <<>>. Usually there is no need to mentioned the 'maven-jar-plugin' explicit cause it's bound to the {{{http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html}Maven Build Life Cycle}}. For full documentation, click {{{./plugin-info.html}here}}.