<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    JBoss Tools Litmus test(s) for project examples/archetypes
</h3>
<span style="margin-bottom: 10px;">
    modified by <a href="https://community.jboss.org/people/maxandersen">Max Rydahl Andersen</a> in <i>JBoss Tools</i> - <a href="https://community.jboss.org/docs/DOC-17655">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>You have created you awesome project example or archetype which creates such example - now how do you know if it works well and especially works well with JBoss Tools ?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The basic litmus test for this is the following steps:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>1) The project can be imported directly and without any errors and no serious warnings with either <strong>File &gt; Import &gt; Existing Projects into Workspace</strong> or <strong>File &gt; Import &gt; Existing Maven Projects *</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>2) The project can be "Runned" on an Installed JBoss server in JBoss Tools by right clicking the project and choose <strong>Run As &gt; Run On Server </strong>which should cause the server to get started, the project to be deployed and then be shown in a web browser (either internally inside Eclipse or externally dependent on your configuration)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Note: </strong>For #1 if your project example/archetype is available from JBoss Central view then this is the basic operation JBoss Central does so using steps in #1 or from JBoss Central are equally good to test if the example works.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If the project deploys and run after the two steps above there is a good chance you've at enabled users to easily try out the example, but there can be a few other good tests/validations to do to make sure the project is using things like Maven and JBoss Tools to the fullest and without encouraging bad practices.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here are a few of the ones we have noticed while trying out examples from various teams:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3>Unnecessary/wrong Jar's being packaged / Missing proper dependency scope</h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>It's a common occurrence that when you use Maven you have a tendency to just add dependencies to the project until things start to work - unfortunately that can have the sideeffect of adding unnecessary jar's into the War or Ear which makes the deployment unnecessary heavy and might cause hard to understand/fix runtime issues.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Adding the following to a pom.xml:</p><p class="p1"><span class="s1">&#160;&#160;&#160;&#160;&#160; </span></p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;dependency&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;groupId&gt;</span>javax.enterprise<span class="jive-xml-tag">&lt;/groupId&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;artifactId&gt;</span>cdi-api<span class="jive-xml-tag">&lt;/artifactId&gt;</span>
 <span class="jive-xml-tag">&lt;/dependency&gt;</span>
</code></pre><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span class="s2">will have such potential side effect.</span></p><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span class="s2">It will make the project compile if it uses CDI api's but it will also bundle the CDI jars into the project. For JBoss AS 7.x this probably will be fine at runtime since JBoss AS 7.x will choose its CDI classes over the bundled API's but it for sure makes your deployment too big and filled with jars that has no purpose.</span></p><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span class="s2">The proper solution is to remember to set the proper dependency scope, like this:</span></p><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;"><span class="s1"> </span>&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;dependency&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;groupId&gt;</span>javax.enterprise<span class="jive-xml-tag">&lt;/groupId&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;artifactId&gt;</span>cdi-api<span class="jive-xml-tag">&lt;/artifactId&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;scope&gt;</span>provided<span class="jive-xml-tag">&lt;/scope&gt;</span>
 <span class="jive-xml-tag">&lt;/dependency&gt;</span>
</code></pre><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span class="s2">Now the project will compile but will assume the jar's are provided in the runtime and thus not bundle the jars.</span></p><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span class="s2"><br/></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> <strong><br/></strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong><br/></strong></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="https://community.jboss.org/docs/DOC-17655">going to Community</a></p>

        <p style="margin: 0;">Create a new document in JBoss Tools at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2128">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>