blob: 4025248e5cbd83afc278799395e9ac5ace8494c6 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>7.4&nbsp;Adding the par plugin</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Creating an application with EclipseRT Virgo Web Server"><link rel="up" href="ch07.html" title="7.&nbsp;Automated Build"><link rel="prev" href="ch07s03.html" title="7.3&nbsp;Create POM"><link rel="next" href="ch07s05.html" title="7.5&nbsp;Adding the dependency plugin"><!--Begin Google Analytics code--><script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2728886-3");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
</script><!--End Google Analytics code--></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">7.4&nbsp;Adding the par plugin</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">7.&nbsp;Automated Build</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch07s05.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="automated.build.par.plugin"></a>7.4&nbsp;Adding the <code class="literal">par</code> plugin</h2></div></div></div><p>
Thorsten Maus contributed a Maven plugin to SpringSource (see <a class="xref" href="apas02.html" title="A.2&nbsp;Documentation">Section&nbsp;A.2, &#8220;Documentation&#8221;</a>)
that builds a PAR file from a list of dependencies. In this step the Maven <code class="literal">par</code> plugin is added
to properly build a PAR artifact type.
</p><p>
In the <code class="literal">&lt;build&gt;&lt;plugins&gt;&#8230;&lt;/plugins&gt;&lt;/build&gt;</code> section, add a plugin declaration for the
<code class="literal">par</code> plugin.
</p><pre class="programlisting">&lt;<span class="hl-tag">plugin</span>&gt;
&lt;<span class="hl-tag">groupId</span>&gt;org.apache.maven.plugins&lt;<span class="hl-tag">/groupId</span>&gt;
&lt;<span class="hl-tag">artifactId</span>&gt;maven-par-plugin&lt;<span class="hl-tag">/artifactId</span>&gt;
&lt;<span class="hl-tag">version</span>&gt;1.0.0.RELEASE&lt;<span class="hl-tag">/version</span>&gt;
&lt;<span class="hl-tag">configuration</span>&gt;
&lt;<span class="hl-tag">applicationSymbolicName</span>&gt;greenpages&lt;<span class="hl-tag">/applicationSymbolicName</span>&gt;
&lt;<span class="hl-tag">applicationDescription</span>&gt;GreenPages&lt;<span class="hl-tag">/applicationDescription</span>&gt;
&lt;<span class="hl-tag">/configuration</span>&gt;
&lt;<span class="hl-tag">/plugin</span>&gt;
</pre><p>
</p><p>
Declare the list of bundles to be packaged in the PAR as dependencies of the PAR project.
</p><pre class="programlisting">&lt;<span class="hl-tag">dependency</span>&gt;
&lt;<span class="hl-tag">groupId</span>&gt;com.springsource.dmserver&lt;<span class="hl-tag">/groupId</span>&gt;
&lt;<span class="hl-tag">artifactId</span>&gt;greenpages.app&lt;<span class="hl-tag">/artifactId</span>&gt;
&lt;<span class="hl-tag">version</span>&gt;${project.version}&lt;<span class="hl-tag">/version</span>&gt;
&lt;<span class="hl-tag">/dependency</span>&gt;
&lt;<span class="hl-tag">dependency</span>&gt;
&lt;<span class="hl-tag">groupId</span>&gt;com.springsource.dmserver&lt;<span class="hl-tag">/groupId</span>&gt;
&lt;<span class="hl-tag">artifactId</span>&gt;greenpages.jpa&lt;<span class="hl-tag">/artifactId</span>&gt;
&lt;<span class="hl-tag">version</span>&gt;${project.version}&lt;<span class="hl-tag">/version</span>&gt;
&lt;<span class="hl-tag">/dependency</span>&gt;
&lt;<span class="hl-tag">dependency</span>&gt;
&lt;<span class="hl-tag">groupId</span>&gt;com.springsource.dmserver&lt;<span class="hl-tag">/groupId</span>&gt;
&lt;<span class="hl-tag">artifactId</span>&gt;greenpages.db&lt;<span class="hl-tag">/artifactId</span>&gt;
&lt;<span class="hl-tag">version</span>&gt;${project.version}&lt;<span class="hl-tag">/version</span>&gt;
&lt;<span class="hl-tag">/dependency</span>&gt;
&lt;<span class="hl-tag">dependency</span>&gt;
&lt;<span class="hl-tag">groupId</span>&gt;com.springsource.dmserver&lt;<span class="hl-tag">/groupId</span>&gt;
&lt;<span class="hl-tag">artifactId</span>&gt;greenpages.web&lt;<span class="hl-tag">/artifactId</span>&gt;
&lt;<span class="hl-tag">version</span>&gt;${project.version}&lt;<span class="hl-tag">/version</span>&gt;
&lt;<span class="hl-tag">type</span>&gt;war&lt;<span class="hl-tag">/type</span>&gt;
&lt;<span class="hl-tag">/dependency</span>&gt;
</pre><p>
</p><p>
Now, run the following command.
</p><pre class="programlisting">mvn clean package</pre><p>
</p><p>
This command will now complete successfully and build a PAR into <code class="filename">target/</code>:
</p><pre class="programlisting">[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building GreenPages PAR
[INFO] task-segment: [clean, package]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] [resources:resources {execution: default-resources}]
[INFO] [par:par {execution: default-par}]
[INFO] Assembling Artifacts for PAR '&#8230;/start/greenpages/target/greenpages-2.3.0.RELEASE.par'
[INFO] Added 'greenpages.app.jar'
[INFO] Added 'greenpages.jpa.jar'
[INFO] Added 'greenpages.db.jar'
[INFO] Added 'greenpages.web.war'
[INFO] [com.springsource.bundlor.:transform {execution: bundlor}]
[INFO] Ignored project with non-bundle packaging: [par]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------</pre><p>
Proceed to the next step.
</p></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript">
_lf_cid = "LF_48be82fa";
_lf_remora();
</script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch07s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7.3&nbsp;Create POM&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;7.5&nbsp;Adding the dependency plugin</td></tr></table></div></body></html>