Max Rydahl Andersen [https://community.jboss.org/people/maxandersen] modified 
the document:

"JBoss Tools Litmus test(s) for project examples/archetypes"

To view the document, visit: https://community.jboss.org/docs/DOC-17655

--------------------------------------------------------------
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 ?

The basic litmus test for this is the following steps:

1) The project can be imported directly and without any errors and no serious 
warnings with either *File > Import > Existing Projects into Workspace* or 
*File > Import > Existing Maven Projects **

2) The project can be "Runned" on an Installed JBoss server in JBoss Tools by 
right clicking the project and choose *Run As > Run On Server* 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)

*Note:* 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.

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.

Here are a few of the ones we have noticed while trying out examples from 
various teams:


h3. Unnecessary/wrong Jar's being packaged / Missing proper dependency scope

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.

Adding the following to a pom.xml:
      
<dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
 </dependency>


will have such potential side effect.

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.

The proper solution is to remember to set the proper dependency scope, like 
this:

 
<dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>provided</scope>
 </dependency>


Now the project will compile but will assume the jar's are provided in the 
runtime and thus not bundle the jars.




 *
*

*
*
--------------------------------------------------------------

Comment by going to Community
[https://community.jboss.org/docs/DOC-17655]

Create a new document in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2128]
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to