| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>7.3 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. Automated Build"><link rel="prev" href="ch07s02.html" title="7.2 Setting up for Automated Build"><link rel="next" href="ch07s04.html" title="7.4 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 Create POM</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s02.html">Prev</a> </td><th width="60%" align="center">7. Automated Build</th><td width="20%" align="right"> <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 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"><<span class="hl-tag">?xml version="1.0" encoding="UTF-8"?</span>> |
| <<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>> |
| |
| <<span class="hl-tag">parent</span>> |
| <<span class="hl-tag">groupId</span>>com.springsource.dmserver<<span class="hl-tag">/groupId</span>> |
| <<span class="hl-tag">artifactId</span>>greenpages.parent<<span class="hl-tag">/artifactId</span>> |
| <<span class="hl-tag">version</span>>2.3.0.RELEASE<<span class="hl-tag">/version</span>> |
| <<span class="hl-tag">relativePath</span>>../parent<<span class="hl-tag">/relativePath</span>> |
| <<span class="hl-tag">/parent</span>> |
| |
| <<span class="hl-tag">modelVersion</span>>4.0.0<<span class="hl-tag">/modelVersion</span>> |
| <<span class="hl-tag">groupId</span>>com.springsource.dmserver<<span class="hl-tag">/groupId</span>> |
| <<span class="hl-tag">artifactId</span>>greenpages<<span class="hl-tag">/artifactId</span>> |
| <<span class="hl-tag">name</span>>GreenPages PAR<<span class="hl-tag">/name</span>> |
| <<span class="hl-tag">packaging</span>>par<<span class="hl-tag">/packaging</span>> |
| |
| <<span class="hl-tag">dependencies</span>> |
| <<span class="hl-tag">/dependencies</span>> |
| |
| <<span class="hl-tag">build</span>> |
| <<span class="hl-tag">plugins</span>> |
| <<span class="hl-tag">/plugins</span>> |
| <<span class="hl-tag">/build</span>> |
| |
| <<span class="hl-tag">/project</span>> |
| </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> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7.2 Setting up for Automated Build </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 7.4 Adding the par plugin</td></tr></table></div></body></html> |