<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>redstream &#187; Artifactory</title>
	<atom:link href="http://www.redstream.nl/tag/artifactory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redstream.nl</link>
	<description>Pragmatic Integrators</description>
	<lastBuildDate>Fri, 27 Jan 2012 19:31:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Create your own Maven2 Archetype</title>
		<link>http://www.redstream.nl/2009/09/30/create-your-own-maven2-archetype/</link>
		<comments>http://www.redstream.nl/2009/09/30/create-your-own-maven2-archetype/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 08:53:28 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[Maven]]></category>
		<category><![CDATA[Artifactory]]></category>

		<guid isPermaLink="false">http://www.pascalalma.net/?p=1008</guid>
		<description><![CDATA[Although I am using Maven for quite some time now over the last years I have never had the need to create my own archetype. Untill my current project. And luckily this is greatly simplified in Maven2.2. The first thing &#8230; <a href="http://www.redstream.nl/2009/09/30/create-your-own-maven2-archetype/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2009%2F09%2F30%2Fcreate-your-own-maven2-archetype%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2009%2F09%2F30%2Fcreate-your-own-maven2-archetype%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Although I am using <a href="http://maven.apache.org/">Maven</a> for quite some time now over the last years I have never had the need to create my own <a href="http://maven.apache.org/plugins/maven-archetype-plugin/">archetype</a>. Untill my current project. And luckily this is greatly simplified in Maven2.2.<br />
The first thing to do is to create your &#8216;base&#8217; module that you want to use as template for your other modules. When this is in place you simply go to the root of your base module and enter:<br />
<code>mvn archetype:create-from-project</code><br />
After this has successfully completed you go to the directory &#8216;target/generated-sources/archetype&#8217; and enter the command:<br />
<code>mvn install</code><br />
And after that you can add the archetype to the catalog in your local repository with the command:<br />
<code>mvn deploy</code><span id="more-1008"></span></p>
<p>In our project we are working with <a href="http://www.jfrog.org/index.php">Artifactory</a> as repository manager, so the next step is to add the archetype catalog to this repository so the rest of the team can use it too. Unfortunately this isn&#8217;t a standard feature (yet) in Artifactory so you will need to perform the following steps to achieve this:</p>
<ul>
<li>Go to the directory in which the local archetype catalog can be found (something like /Users/name/.m2/ on the Mac)</li>
<li>Perform the command<br />
<blockquote><p>curl -u username:password -f -d @archetype-catalog.xml -X PUT &#8220;http://artifactory-server:8888/artifactory/libs-releases-local/archetype-catalog.xml&#8221;</p></blockquote>
<p>Here username and password are the credentials you use to login to your Artifactory instance</li>
</ul>
<p>Now the archetype is ready to be used. To make use of it you can either:</p>
<ul>
<li>Add the catalog to use as parameter in the command:<br />
<code>mvn archetype:generate -DarchetypeCatalog=http://artifactory-server:8888/artifactory/libs-releases-local/</code>
</li>
<p>or</p>
<li>
Define it in the plugin of the parent pom:</p>

<div class="wp_codebox"><table><tr id="p10082"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p1008code2"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-archetype-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0-alpha-4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;archetypeCatalog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://artifactory-server:8888/artifactory/libs-releases-local/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/archetypeCatalog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>and then simply use:<br />
<code>mvn archetype:generate</code>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2009/09/30/create-your-own-maven2-archetype/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

