blob: a73a8caca09ef37809cb8efea4d6c6141b338d8e [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Archiva Documentation - Writing a Consumer Plugin</title>
<style type="text/css" media="all">
@import url("../css/maven-base.css");
@import url("../css/maven-theme.css");
@import url("../css/site.css");
</style>
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
<meta name="author" content="Maria Odea Ching" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<?xml version="1.0" encoding="UTF-8"?>
<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>
<?xml version="1.0" encoding="UTF-8"?>
<script type="text/javascript">var pageTracker = _gat._getTracker("UA-140879-5");
pageTracker._initData();
pageTracker._trackPageview();</script>
</head>
<body class="composite">
<div id="banner">
<a href="../../" id="bannerLeft">
<img src="http://archiva.apache.org/images/archiva.png" alt="" />
</a>
<a href="http://www.apache.org/" id="bannerRight">
<img src="http://www.apache.org/images/asf_logo_wide.png" alt="" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<a href="http://www.apache.org/">Apache</a>
&gt;
<a href="../../../">Archiva</a>
&gt;
<a href="../index.html">1.3.8</a>
</div>
<div class="xright">
&nbsp;| Last Published: 11 Apr 2014
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Introduction</h5>
<ul>
<li class="none">
<a href="../quick-start.html">Quick Start</a>
</li>
<li class="none">
<a href="../tour/index.html">Feature Tour</a>
</li>
<li class="none">
<a href="../release-notes.html">Release Notes</a>
</li>
<li class="none">
<a href="http://archiva.apache.org/download.html">Downloads</a>
</li>
</ul>
<h5>Users Guide</h5>
<ul>
<li class="none">
<a href="../userguide/browsing.html">Browsing</a>
</li>
<li class="none">
<a href="../userguide/searching.html">Searching</a>
</li>
<li class="none">
<a href="../userguide/find-artifact.html">Identifying an Artifact</a>
</li>
<li class="none">
<a href="../userguide/delete-artifact.html">Deleting an Artifact</a>
</li>
<li class="none">
<a href="../userguide/using-repository.html">Using as a repository</a>
</li>
<li class="none">
<a href="../userguide/deploy.html">Deploying to repository</a>
</li>
<li class="none">
<a href="../userguide/virtual-repositories.html">Configuring Virtual Repositories</a>
</li>
<li class="none">
<a href="../userguide/rss.html">Rss Feeds in Archiva</a>
</li>
<li class="none">
<a href="../userguide/auditlog-report.html">Audit Log Report</a>
</li>
</ul>
<h5>Administrators Guide</h5>
<ul>
<li class="collapsed">
<a href="../adminguide/installing.html">Installing Archiva</a>
</li>
<li class="none">
<a href="../adminguide/databases.html">Databases</a>
</li>
<li class="collapsed">
<a href="../adminguide/security.html">Security</a>
</li>
<li class="collapsed">
<a href="../adminguide/configuration.html">Runtime Configuration</a>
</li>
<li class="none">
<a href="../adminguide/configuration-files.html">Configuration Files</a>
</li>
<li class="collapsed">
<a href="../adminguide/logging.html">Log Files</a>
</li>
<li class="none">
<a href="../adminguide/reports.html">Reports</a>
</li>
<li class="none">
<a href="../adminguide/web-services.html">Web Services</a>
</li>
</ul>
<h5>Customising Archiva</h5>
<ul>
<li class="none">
<strong>Writing a Consumer Plugin</strong>
</li>
</ul>
<h5>More Information</h5>
<ul>
<li class="none">
<a href="http://cwiki.apache.org/confluence/display/ARCHIVA/Index">Archiva Wiki</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy">
<img alt="Built by Maven" src="../images/logos/maven-feather.png"></img>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<div class="section"><h2>Writing a Consumer Plugin</h2><p>For a sample custom consumer, you can checkout the archiva-consumer-plugin at the archiva sandbox in the SVN repository:</p><div class="source"><pre>http://svn.apache.org/repos/asf/archiva/sandbox/archiva-consumer-plugin</pre></div><p>Below are the steps on how to create a custom repository consumer and plug it in Archiva:</p><ol type="1"><li>Create a project for your component.</li><li>Declare your class or in this case, consumer as a component as shown in the example below. This should be put at the class level.<div class="source"><pre>Ex.
@plexus.component role=&quot;org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer&quot;
role-hint=&quot;discover-new-artifact&quot;
instantiation-strategy=&quot;per-lookup&quot;
where,
role: the interface that your class implements
role-hint: the lookup name of the component (your class/consumer)
instantiation-strategy: how your class will be instantiated</pre></div></li><li>Make sure to add the snippet below in the <i>build</i> section of the project's pom. This is needed to generate the components.xml.<div class="source"><pre>&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.plexus&lt;/groupId&gt;
&lt;artifactId&gt;plexus-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;1.3.5&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;generate&lt;/id&gt;
&lt;goals&gt;
&lt;goal&gt;descriptor&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;</pre></div></li><li>Package your project by executing 'mvn clean package'</li><li>Let's say you are using the apache-archiva-1.0-bin.tar.gz to run Archiva. Unpack the binaries then go to bin/linux-x86-32/ (assuming you are running on Linux), then execute './run.sh console'. Then stop or shutdown Archiva after it started. (This is necessary to unpack the war file.)</li><li>Copy the jar file you created in step 4 in apache-archiva-1.0/apps/archiva/webapp/lib/</li><li>Add the necessary configurations in archiva.xml (in this case, add 'discover-new-artifact' as a <i>knownContentConsumer</i>)</li><li>Start up Archiva again.</li></ol></div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">&#169;
2006-2014
The Apache Software Foundation
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>