camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Babak Vahdat (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache Camel > Guice Maven Plugin
Date Wed, 04 Dec 2013 17:19:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Guice+Maven+Plugin">Guice
Maven Plugin</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~bvahdat">Babak
Vahdat</a>
    </h4>
        <br/>
                         <h4>Changes (3)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >*Available as of Camel 2.13.0* <br>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">In
case you want to make use of an optional JNDI properties file, for example in case when [the
GuiceyFruit JNDI Provider|https://code.google.com/p/guiceyfruit/wiki/JNDI] is in use, then
this is how you can specify it: <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Optionally
if the name of your JNDI property file is something else other than the default {{jndi.properties}}
or if it&#39;s not on the default classpath, then you can make use of the {{jndiProperties}}
option as shown below: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:lang=xml} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  &lt;artifactId&gt;guice-maven-plugin/artifactId&gt;
<br>  &lt;configuration&gt; <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">&lt;jndiProperties&gt;/<span
class="diff-added-chars"style="background-color: #dfd;">path/to/</span>my<span
class="diff-added-chars"style="background-color: #dfd;">/jndi/properties/my</span>-guice-jndi.properties&lt;/jndiProperties&gt;</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >  &lt;/configuration&gt; <br>&lt;/plugin&gt;
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="GuiceMavenPlugin-GuiceMavenPlugin"></a>Guice Maven
Plugin</h2>

<p>The <a href="http://activemq.apache.org/camel/maven/maven-plugins/guice-maven-plugin/plugin-info.html"
class="external-link" rel="nofollow">Guice Maven Plugin</a> allows you to run your
<a href="/confluence/display/CAMEL/Enterprise+Integration+Patterns" title="Enterprise Integration
Patterns">Enterprise Integration Patterns</a> using <a href="/confluence/display/CAMEL/Guice"
title="Guice">Guice</a> for <a href="/confluence/display/CAMEL/Dependency+Injection"
title="Dependency Injection">Dependency Injection</a> inside Maven along with being
able to support <a href="/confluence/display/CAMEL/Visualisation" title="Visualisation">Visualisation</a>
along with integration of the <a href="/confluence/display/CAMEL/Visualisation" title="Visualisation">Visualisation</a>
diagrams into the standard maven reports for your project.</p>

<h3><a name="GuiceMavenPlugin-GoalsSupported"></a>Goals Supported</h3>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Documentation </th>
<th class='confluenceTh'> Reference </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <a href="/confluence/display/CAMEL/Guice+Run+Maven+Goal"
title="Guice Run Maven Goal">guice:run</a> </td>
<td class='confluenceTd'> <a href="http://activemq.apache.org/camel/maven/maven-plugins/guice-maven-plugin/run-mojo.html"
class="external-link" rel="nofollow">guice:run</a> </td>
<td class='confluenceTd'> Boots up Camel in the context of a separately initiated Java
thread using the <a href="/confluence/display/CAMEL/Guice" title="Guice">Guice</a>
configuration in the <b>jndi.properties</b> file on the classpath and runs your
routing rules </td>
</tr>
<tr>
<td class='confluenceTd'> <a href="/confluence/display/CAMEL/Guice+Embedded+Maven+Goal"
title="Guice Embedded Maven Goal">guice:embedded</a> </td>
<td class='confluenceTd'> <a href="http://activemq.apache.org/camel/maven/maven-plugins/guice-maven-plugin/embedded-mojo.html"
class="external-link" rel="nofollow">guice:embedded</a> </td>
<td class='confluenceTd'> Boots up Camel using the <a href="/confluence/display/CAMEL/Guice"
title="Guice">Guice</a> configuration at <b>jndi.properties</b> on the
classpath and runs your routing rules </td>
</tr>
<tr>
<td class='confluenceTd'> <a href="/confluence/display/CAMEL/Guice+Dot+Maven+Goal+"
title="Guice Dot Maven Goal ">guice:dot</a> </td>
<td class='confluenceTd'> <a href="http://activemq.apache.org/camel/maven/maven-plugins/guice-maven-plugin/dot-mojo.html"
class="external-link" rel="nofollow">guice:dot</a> </td>
<td class='confluenceTd'> Generates DOT files and then HTML, PNG, SVG files for your
EIP routing rules with integration into Maven Reports </td>
</tr>
</tbody></table>
</div>


<h3><a name="GuiceMavenPlugin-Addingtheplugintoyourpom.xml"></a>Adding the
plugin to your pom.xml</h3>

<p>Add the following in your &lt;build&gt;&lt;plugins&gt; section</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;plugin&gt;
  &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
  &lt;artifactId&gt;guice-maven-plugin/artifactId&gt;
&lt;/plugin&gt;
</pre>
</div></div>

<p>You can also specify what Main class to use when running the plugin. By default this
is org.apache.camel.guice.Main.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;plugin&gt;
  &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
  &lt;artifactId&gt;guice-maven-plugin/artifactId&gt;
  &lt;!-- optional, default value: org.apache.camel.guice.Main --&gt;
  &lt;configuration&gt;
    &lt;mainClass&gt;mypackage.boot.camel.CamelStartup&lt;/mainClass&gt;
  &lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
</div></div>

<h3><a name="GuiceMavenPlugin-MakinguseofanoptionalJNDIpropertiesfile"></a>Making
use of an optional JNDI properties file</h3>

<p><b>Available as of Camel 2.13.0</b></p>

<p>Optionally if the name of your JNDI property file is something else other than the
default <tt>jndi.properties</tt> or if it's not on the default classpath, then
you can make use of the <tt>jndiProperties</tt> option as shown below:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;plugin&gt;
  &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
  &lt;artifactId&gt;guice-maven-plugin/artifactId&gt;
  &lt;configuration&gt;
    &lt;jndiProperties&gt;/path/to/my/jndi/properties/my-guice-jndi.properties&lt;/jndiProperties&gt;
  &lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
</div></div>

<h3><a name="GuiceMavenPlugin-Classpath"></a>Classpath</h3>

<p>The plugin will construct a classpath of any Maven dependency with scope "compile".
 The classpath is output as an INFO log statement upon startup.</p>

<h3><a name="GuiceMavenPlugin-RouteInformation"></a>Route Information</h3>

<p>Information about the generated routes is available through the GraphViz report,
and also through the log statements generated by the run goal.  If you would like to see this
information then add a log4j (or other commons-logging implementation) config file with the
following levels.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>src/main/resources/log4.properties</b></div><div
class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

log4j.logger.org.apache.camel.impl.DefaultCamelContext=DEBUG, stdout
log4j.additivity.org.apache.camel.impl.DefaultCamelContext=false
</pre>
</div></div>

<p>This should produce a log statement similar to:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
670  [org.apache.camel.guice.Main.main()] DEBUG org.apache.camel.impl.DefaultCamelContext
 
  - Adding routes from: Routes: [Route[ [From[jms:queue:queueA]] -&gt; [To[jms:queue:queueB],
To[jms:queue:queueC]]]] routes: []
</pre>
</div></div>

<h3><a name="GuiceMavenPlugin-IntegrationintoMavenReports"></a>Integration
into Maven Reports</h3>

<p>If you add the guice-maven-plugin to your &lt;reporting&gt; section of your
pom you will automatically get the <a href="/confluence/display/CAMEL/Visualisation" title="Visualisation">Visualisation</a>
reporting generated for your project as part of the regular maven site generation.</p>

<p>For example add the following into your pom</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;project&gt;
  ...
  &lt;reporting&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
        &lt;artifactId&gt;guice-maven-plugin/artifactId&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/reporting&gt;  
&lt;/project&gt;
</pre>
</div></div>

<p>Then when you run</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
mvn site
</pre>
</div></div>

<p>Your context will be booted up via the <b>jndi.properties</b> files,
the DOT file generated and a nice HTML report created. </p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>GraphViz
DOT required</b><br />Note to get the nice HTML, PNG and SVG outputs from the
DOT files you will need to install the <a href="http://graphviz.org" class="external-link"
rel="nofollow">GraphViz</a> DOT executable and add it to your PATH so that the plugin
can invoke DOT to generate the PNG/SVG files. 

<p>For more details see the <a href="/confluence/display/CAMEL/Camel+Dot+Maven+Goal"
title="Camel Dot Maven Goal">guice:dot</a>.</p></td></tr></table></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CAMEL">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Guice+Maven+Plugin">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=99989&revisedVersion=10&originalVersion=9">View
Changes</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message