blob: 03f9891287890fb332bd35c378d61631f52cfd24 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>7.3&nbsp;Create POM</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="ch07s02.html" title="7.2&nbsp;Setting up for Automated Build"><link rel="next" href="ch07s04.html" title="7.4&nbsp;Adding the par 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.3&nbsp;Create POM</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s02.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="ch07s04.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.create.pom"></a>7.3&nbsp;Create POM</h2></div></div></div><p>
All of the projects except the PAR project have Maven POM files for building. In this step
an initial POM file for the PAR is created.
</p><p>
Using a text editor create a file called <code class="filename">$GREENPAGES_HOME/start/greenpages/pom.xml</code>.
Open this file and add the following skeleton to it:
</p><pre class="programlisting">&lt;<span class="hl-tag">?xml version="1.0" encoding="UTF-8"?</span>&gt;
&lt;<span class="hl-tag">project</span>
<span class="hl-attribute">xmlns</span>=<span class="hl-value">"http://maven.apache.org/POM/4.0.0"</span>
<span class="hl-attribute">xmlns:xsi</span>=<span class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span>
<span class="hl-attribute">xsi:schemaLocation</span>=<span class="hl-value">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"</span>&gt;
&lt;<span class="hl-tag">parent</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.parent&lt;<span class="hl-tag">/artifactId</span>&gt;
&lt;<span class="hl-tag">version</span>&gt;2.3.0.RELEASE&lt;<span class="hl-tag">/version</span>&gt;
&lt;<span class="hl-tag">relativePath</span>&gt;../parent&lt;<span class="hl-tag">/relativePath</span>&gt;
&lt;<span class="hl-tag">/parent</span>&gt;
&lt;<span class="hl-tag">modelVersion</span>&gt;4.0.0&lt;<span class="hl-tag">/modelVersion</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&lt;<span class="hl-tag">/artifactId</span>&gt;
&lt;<span class="hl-tag">name</span>&gt;GreenPages PAR&lt;<span class="hl-tag">/name</span>&gt;
&lt;<span class="hl-tag">packaging</span>&gt;par&lt;<span class="hl-tag">/packaging</span>&gt;
&lt;<span class="hl-tag">dependencies</span>&gt;
&lt;<span class="hl-tag">/dependencies</span>&gt;
&lt;<span class="hl-tag">build</span>&gt;
&lt;<span class="hl-tag">plugins</span>&gt;
&lt;<span class="hl-tag">/plugins</span>&gt;
&lt;<span class="hl-tag">/build</span>&gt;
&lt;<span class="hl-tag">/project</span>&gt;
</pre><p>
ensuring that the version numbers are consistent
(for example, <code class="literal">2.3.0.RELEASE</code> might be <code class="literal">2.3.0</code>
depending on which version of <code class="literal">greenpages</code> being developed).
</p><p>
This skeleton defines a basic configuration with a parent POM. Notice that the <code class="literal">packaging</code>
type is <code class="literal">par</code>. After this file is created execute the following command from the
<code class="filename">$GREENPAGES_HOME/start/greenpages</code> directory.
</p><pre class="programlisting">mvn clean package</pre><p>
</p><p>
This command returns an error indicating that Maven does not know how to build a PAR:
</p><pre class="programlisting">[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-par-plugin' does not exist
[INFO] or no valid version could be found
[INFO] ------------------------------------------------------------------------
</pre><p>
The next step will correct this.
</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="ch07s02.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="ch07s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7.2&nbsp;Setting up for Automated Build&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.4&nbsp;Adding the par plugin</td></tr></table></div></body></html>