<?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 Blog &#187; Artifactory</title>
	<atom:link href="http://blog.redstream.nl/tag/artifactory/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.redstream.nl</link>
	<description>Pragmatic Integrators</description>
	<lastBuildDate>Mon, 26 Jul 2010 06:09:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4067</generator>
		<item>
		<title>Create your own Maven2 Archetype</title>
		<link>http://blog.redstream.nl/2009/09/30/create-your-own-maven2-archetype/</link>
		<comments>http://blog.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>
		<category><![CDATA[Maven2]]></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 to do is to create your 'base' module that you want to use as template [...]]]></description>
			<content:encoded><![CDATA[<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 'base' 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 'target/generated-sources/archetype' 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'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 "http://artifactory-server:8888/artifactory/libs-releases-local/archetype-catalog.xml"</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="igBar"><span id="lxml-2"><a href="#" onclick="javascript:showCodeTxt('xml-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-2">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;plugin<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;groupId<span style="font-weight: bold; color: black;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/groupId<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;artifactId<span style="font-weight: bold; color: black;">&gt;</span></span></span>maven-archetype-plugin<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/artifactId<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;version<span style="font-weight: bold; color: black;">&gt;</span></span></span>2.0-alpha-4<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/version<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;configuration<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;archetypeCatalog<span style="font-weight: bold; color: black;">&gt;</span></span></span>http://artifactory-server:8888/artifactory/libs-releases-local/<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/archetypeCatalog<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/configuration<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B; font-weight:bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/plugin<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
and then simply use:<br />
<code>mvn archetype:generate</code>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.redstream.nl/2009/09/30/create-your-own-maven2-archetype/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
