Modified: 
websites/production/maven/content/plugins-archives/maven-jar-plugin-LATEST/usage.html
==============================================================================
--- 
websites/production/maven/content/plugins-archives/maven-jar-plugin-LATEST/usage.html
 (original)
+++ 
websites/production/maven/content/plugins-archives/maven-jar-plugin-LATEST/usage.html
 Thu Jun 19 12:01:56 2014
@@ -1,8 +1,11 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<!-- Generated by Apache Maven Doxia at Feb 1, 2012 -->
+<!--
+ | Generated by Apache Maven Doxia at 2014-06-19
+ | Rendered using Apache Maven Stylus Skin 1.5
+-->
 <html xmlns="http://www.w3.org/1999/xhtml";>
   <head>
-    <title>Usage</title>
+    <title>Apache Maven JAR Plugin - Usage</title>
     <style type="text/css" media="all">
       @import url("./css/maven-base.css");
       @import url("./css/maven-theme.css");
@@ -13,14 +16,14 @@
 Dennis Lundberg
 Olivier Lamy" />
         <meta name="Date-Creation-yyyymmdd" content="20110817" />
-    <meta name="Date-Revision-yyyymmdd" content="20120201" />
+    <meta name="Date-Revision-yyyymmdd" content="20140619" />
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                                                     
-<script type="text/javascript" 
src="http://www.google-analytics.com/urchin.js";></script>
+<script src="http://www.google-analytics.com/urchin.js"; 
type="text/javascript"></script>
                                                         
 <script type="text/javascript">_uacct = "UA-140879-1";
         urchinTracker();</script>
-                    </head>
+                              </head>
   <body class="composite">
     <div id="banner">
                                       <a href="../../" id="bannerLeft">
@@ -35,20 +38,20 @@ Olivier Lamy" />
     </div>
     <div id="breadcrumbs">
             
-                                <div class="xleft">
+                                   <div class="xleft">
                           <a href="http://www.apache.org/"; 
class="externalLink">Apache</a>
         &gt;
                   <a href="../../index.html">Maven</a>
         &gt;
                   <a href="../index.html">Plugins</a>
         &gt;
-                      <a href="./">Maven Jar plugin</a>
+                      <a href="./">Apache Maven JAR Plugin</a>
         &gt;
-    Usage
-      </div>
+        Usage
+        </div>
             <div class="xright">        
-                                 Last Published: 2012-02-01
-              &nbsp;| Version: 2.4
+                                    Last Published: 2014-06-19
+              &nbsp;| Version: 2.5
             </div>
       <div class="clear">
         <hr/>
@@ -57,7 +60,7 @@ Olivier Lamy" />
     <div id="leftColumn">
       <div id="navcolumn">
              
-                                                <h5>Overview</h5>
+                                                   <h5>Overview</h5>
                   <ul>
                   <li class="none">
                   <a href="index.html">Introduction</a>
@@ -71,6 +74,12 @@ Olivier Lamy" />
                   <li class="none">
                   <a href="faq.html">FAQ</a>
             </li>
+                  <li class="none">
+                  <a href="http://www.apache.org/licenses/"; 
class="externalLink">License</a>
+            </li>
+                  <li class="none">
+                  <a href="download.html">Download</a>
+            </li>
           </ul>
                        <h5>Examples</h5>
                   <ul>
@@ -86,13 +95,22 @@ Olivier Lamy" />
                   <li class="none">
                   <a 
href="../../shared/maven-archiver/examples/manifestFile.html">Using Your Own 
Manifest File</a>
             </li>
+                  <li class="none">
+                  <a href="examples/attached-jar.html">Additional attached 
JAR</a>
+            </li>
+                  <li class="none">
+                  <a href="examples/create-test-jar.html">Create Test JAR</a>
+            </li>
+                  <li class="none">
+                  <a href="examples/include-exclude.html">Include/Exclude 
clases</a>
+            </li>
           </ul>
                        <h5>Project Documentation</h5>
                   <ul>
-                                                                               
                                                                                
                                                                                
                           <li class="collapsed">
+                                                                               
                                                                                
                                                                                
                                                               <li 
class="collapsed">
                   <a href="project-info.html">Project Information</a>
                   </li>
-                                                                               
                                                                                
                                                                                
                                             <li class="collapsed">
+                                                                    <li 
class="collapsed">
                   <a href="project-reports.html">Project Reports</a>
                   </li>
           </ul>
@@ -117,15 +135,24 @@ Olivier Lamy" />
                   <a href="../../index.html">Maven 2 & 3</a>
             </li>
                   <li class="none">
+                  <a href="../../pom/index.html">Parent POMs</a>
+            </li>
+                  <li class="none">
                   <a href="../index.html">Plugins</a>
             </li>
                   <li class="none">
+                  <a href="../../plugin-tools/index.html">Plugin Tools</a>
+            </li>
+                  <li class="none">
                   <a href="../../scm/index.html">SCM</a>
             </li>
                   <li class="none">
                   <a href="../../shared/index.html">Shared Components</a>
             </li>
                   <li class="none">
+                  <a href="../../skins/index.html">Skins</a>
+            </li>
+                  <li class="none">
                   <a href="../../surefire/index.html">Surefire</a>
             </li>
                   <li class="none">
@@ -151,107 +178,34 @@ Olivier Lamy" />
           <img alt="Built by Maven" src="./images/logos/maven-feather.png"/>
         </a>
                        
-                            </div>
+                               </div>
     </div>
     <div id="bodyColumn">
       <div id="contentBox">
-        <!-- 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 --><div class="section"><h2>Usage<a name="Usage"></a></h2><p>Some 
brief examples on how to use this plugin. If you want to use advanced 
configurations you should have a look at the documentation for <a 
class="externalLink" 
href="http://maven.apache.org/shared/maven-archiver/";>Maven 
Archiver</a>.</p><p>To handle archiving this version of Maven JAR Plugin uses 
<a class="externalLink" 
href="http://maven.apache.org/shared/maven-archiver/index.html";>Maven 
Archiver</a> 2.5.</p><p><b>Note:</b> 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 <a class="externalLink" 
href="http://maven.apache.org/plugins/maven-jarsigner-plugin/";>Maven Jarsigner 
Plugin</a> instead.</p><div class="section"><h3>How to build a JAR file<a 
name="How_to_build_a_JAR_file"></a></h3><p>If the packaging of your project is 
set to 'jar', this plugin is executed whenever it passes the &quot;pack
 age&quot; phase. You can execute it using the command below:</p><div 
class="source"><pre>mvn package</pre></div><p>In your project's <tt>target</tt> 
directory you'll able to see the generated jar file.</p></div><div 
class="section"><h3>How to include/exclude content from jar artifact<a 
name="How_to_includeexclude_content_from_jar_artifact"></a></h3><p>Specify a 
list of fileset patterns to be included or excluded by adding 
<tt>&lt;includes&gt;</tt>/<tt>&lt;include&gt;</tt> or 
<tt>&lt;excludes&gt;</tt>/<tt>&lt;exclude&gt;</tt> in your 
<tt>pom.xml</tt>.</p><div class="source"><pre>&lt;project&gt;
-  ...
-  &lt;build&gt;
-    &lt;plugins&gt;
-      ...
-      &lt;plugin&gt;
-        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
-        &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
-        &lt;version&gt;2.4&lt;/version&gt;
-        &lt;configuration&gt;
-          &lt;includes&gt;
-            &lt;include&gt;**/service/*&lt;/include&gt;
-          &lt;/includes&gt;
-        &lt;/configuration&gt;
-      &lt;/plugin&gt;
-      ...
-    &lt;/plugins&gt;
-  &lt;/build&gt;
-  ...
-&lt;/project&gt;</pre></div><p>Note that the patterns need to be relative to 
the path specified for the plugin's <tt>classesDirectory</tt> 
parameter.</p></div><div class="section"><h3>How to create an additional 
attached jar artifact from the project<a 
name="How_to_create_an_additional_attached_jar_artifact_from_the_project"></a></h3><p>Specify
 a list of fileset patterns to be included or excluded by adding 
<tt>&lt;includes&gt;</tt>/<tt>&lt;include&gt;</tt> or 
<tt>&lt;excludes&gt;</tt>/<tt>&lt;exclude&gt;</tt> and add a 
<tt>classifier</tt> in your <tt>pom.xml</tt>.</p><p><b>Note:</b> the jar-plugin 
must be defined in a new execution, otherwise it will replace the default use 
of the jar-plugin instead of adding a second artifact. The <tt>classifier</tt> 
is also required to create more than one artifact.</p><div 
class="source"><pre>&lt;project&gt;
-  ...
-  &lt;build&gt;
-    &lt;plugins&gt;
-      ...
-      &lt;plugin&gt;
-        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
-        &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
-        &lt;version&gt;2.4&lt;/version&gt;
-        &lt;executions&gt;
-          &lt;execution&gt;
-            &lt;phase&gt;package&lt;/phase&gt;
-            &lt;goals&gt;
-              &lt;goal&gt;jar&lt;/goal&gt;
-            &lt;/goals&gt;
-            &lt;configuration&gt;
-              &lt;classifier&gt;client&lt;/classifier&gt;
-              &lt;includes&gt;
-                &lt;include&gt;**/service/*&lt;/include&gt;
-              &lt;/includes&gt;
-            &lt;/configuration&gt;
-          &lt;/execution&gt;
-        &lt;/executions&gt;
-      &lt;/plugin&gt;
-      ...
-    &lt;/plugins&gt;
-  &lt;/build&gt;
-  ...
-&lt;/project&gt;</pre></div></div><div class="section"><h3>How to create a jar 
containing test classes<a 
name="How_to_create_a_jar_containing_test_classes"></a></h3><p>When you want to 
create a jar containing test-classes, you would probably want to reuse those 
classes. There are two ways to solve this:</p><ul><li>Create an attached jar 
with the test-classes from the current project and loose its transitive 
<tt>test</tt>-scoped dependencies.</li><li>Create a separate project with the 
test-classes.</li></ul><div class="section"><h4>The easy way <a 
name="The_easy_way"></a></h4><p>You can produce a jar which will include your 
test classes and resources.</p><div class="source"><pre>&lt;project&gt;
-  ...
-  &lt;build&gt;
-    &lt;plugins&gt;
-      ...
-      &lt;plugin&gt;
-        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
-        &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
-        &lt;version&gt;2.4&lt;/version&gt;
-        &lt;executions&gt;
-          &lt;execution&gt;
-            &lt;goals&gt;
-              &lt;goal&gt;test-jar&lt;/goal&gt;
-            &lt;/goals&gt;
-          &lt;/execution&gt;
-        &lt;/executions&gt;
-      &lt;/plugin&gt;
-      ...
-    &lt;/plugins&gt;
-  &lt;/build&gt;
-  ...
-&lt;/project&gt;</pre></div><p>To reuse this artifact in an other project, you 
must declare this dependency with classifier test-jar :</p><div 
class="source"><pre>&lt;project&gt;
-  ...
-  &lt;dependencies&gt;
-    &lt;dependency&gt;
-      &lt;groupId&gt;groupId&lt;/groupId&gt;
-      &lt;artifactId&gt;artifactId&lt;/artifactId&gt;
-      &lt;type&gt;test-jar&lt;/type&gt;
-      &lt;version&gt;version&lt;/version&gt;
-      &lt;scope&gt;test&lt;/scope&gt;
-    &lt;/dependency&gt;
-  &lt;/dependencies&gt;
-  ...
-&lt;/project&gt;</pre></div><p><b>Note:</b> The downside of this solution is 
that you don't get the transitive <tt>test</tt>-scoped dependencies 
automatically. Maven only resolves the <tt>compile</tt>-time dependencies, so 
you'll have to add all the other required <tt>test</tt>-scoped dependencies by 
hand.</p></div><div class="section"><h4>The preferred way<a 
name="The_preferred_way"></a></h4><p>In order to let Maven resolve all 
<tt>test</tt>-scoped transitive dependencies you should create a separate 
project.</p><div class="source"><pre>&lt;project&gt;
-   &lt;groupId&gt;groupId&lt;/groupId&gt;
-    &lt;artifactId&gt;artifactId-tests&lt;/artifactId&gt;
-    &lt;version&gt;version&lt;/version&gt;
-  ...
-&lt;/project&gt;</pre></div><ul><li>Move the sources files from 
<tt>src/test/java</tt> you want to share from the original project to the 
<tt>src/main/java</tt> of this project. The same type of movement counts for 
the resources as well of course.</li><li>Move the required <tt>test</tt>-scoped 
dependencies and from the original project to this project and remove the scope 
(i.e. changing it to the <tt>compile</tt>-scope). And yes, that means that the 
junit dependency (or any other testing framework dependency) gets the default 
scope too. You'll probably need to add some project specific dependencies as 
well to let it all compile again.</li></ul><p>Now you have your reusable 
test-classes and you can refer to it as you're used to:</p><div 
class="source"><pre>&lt;project&gt;
-  ...
-  &lt;dependencies&gt;
-    &lt;dependency&gt;
-      &lt;groupId&gt;groupId&lt;/groupId&gt;
-      &lt;artifactId&gt;artifactId-tests&lt;/artifactId&gt;
-      &lt;version&gt;version&lt;/version&gt;
-      &lt;scope&gt;test&lt;/scope&gt;
-    &lt;/dependency&gt;
-  &lt;/dependencies&gt;
-  ...
-&lt;/project&gt;</pre></div><p>For full documentation, click <a 
href="./plugin-info.html">here</a>.</p></div></div></div>
+        <!-- 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 --><div class="section">
+<h2>Usage<a name="Usage"></a></h2>
+<p>Some brief examples on how to use this plugin. If you want to use advanced 
configurations you should have a look at the <a 
href="./index.html#Examples">Example section</a>. documentation for <a 
class="externalLink" 
href="http://maven.apache.org/shared/maven-archiver/";>Maven Archiver</a>.</p>
+<p>To handle archiving this version of Maven JAR Plugin uses <a 
class="externalLink" 
href="http://maven.apache.org/shared/maven-archiver/index.html";>Maven 
Archiver</a> 2.5.</p>
+<p><b>Note:</b> 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 <a class="externalLink" 
href="http://maven.apache.org/plugins/maven-jarsigner-plugin/";>Maven Jarsigner 
Plugin</a> instead. As of the current version 2.5, the corresponding goals were 
removed.</p>
+<div class="section">
+<h3>How to build a JAR file<a name="How_to_build_a_JAR_file"></a></h3>
+<p>When you want to create a JAR-file with Maven, you first have to create a 
<tt>pom.xml</tt>-file with at least the following content:</p>
+<div class="source">
+<pre>&lt;project&gt;
+  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
+  
+  &lt;groupId&gt;com.mycompany.project&lt;/groupId&gt;
+  &lt;artifactId&gt;core&lt;/artifactId&gt;
+  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
+  &lt;!-- &lt;packaging&gt;jar&lt;/packaging&gt;  --&gt;
+&lt;/project&gt;</pre></div>
+<p>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 <tt>src/main/java</tt>. If you need extra 
resources on your classpath (for example property files) they should be located 
in <tt>src/main/resources</tt>. Now we can create a JAR-file by using the 
command below:</p>
+<div class="source">
+<pre>mvn package</pre></div>
+<p>The 'package' phase is always responsible for bundling all the files in the 
artifact, in this case a JAR-file.</p>
+<p>In your project's <tt>target</tt> 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 
<tt>src/main/resources</tt>.</p>
+<p>Usually there is no need to mentioned the 'maven-jar-plugin' explicit cause 
it's bound to the <a class="externalLink" 
href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html";>Maven
 Build Life Cycle</a>.</p>
+<p>For full documentation, click <a 
href="./plugin-info.html">here</a>.</p></div></div>
       </div>
     </div>
     <div class="clear">
@@ -259,10 +213,10 @@ Olivier Lamy" />
     </div>
     <div id="footer">
       <div class="xright">
-        &#169;            2002-2012
+        &#169;            2002-2014
               The Apache Software Foundation
             
-                       - <a 
href="http://maven.apache.org/privacy-policy.html";>Privacy Policy</a>.
+                          - <a 
href="http://maven.apache.org/privacy-policy.html";>Privacy Policy</a>.
         Apache Maven, Maven, Apache, the Apache feather logo, and the Apache 
Maven project logos are trademarks of The Apache Software Foundation.
       </div>
       <div class="clear">
@@ -270,4 +224,4 @@ Olivier Lamy" />
       </div>
     </div>
   </body>
-</html>
+</html>
\ No newline at end of file


Reply via email to