Enterprise grade Java.
You'll read about Conferences, Java User Groups, Java, Integration, Reactive, Microservices and other technologies.

Wednesday, January 20, 2010

GlassFish v3, CDI, Maven, Eclipse

07:51 Wednesday, January 20, 2010 Posted by Markus Eisele
, , , ,
I am disaffected with NetBeans. It looks fancy, but I still can't get back the love I had using the 3.x version :) Seems as if I am converted to an Eclipse lover.
This was the point where I started to try getting CDI examples to work with GlassFish v3, CDI/Weld, Maven and Eclipse.
For those of you, haven't made it. Here is the how-to (I am using versions with the numbers in brackets):

1) Get:
- Maven (2.2.1)
- Eclipse (3.6M2)
- GlassFish (v3 build 74.2)

2) Create a maven project using:

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=cditests -DarchetypeArtifactId=maven-archetype-webapp

3) Add a my-webapp\src\main\java folder to it
4) Add the following dependencies to the my-webapp\pom.xml




5) Add an empty file named beans.xml to my-webapp\src\main\webapp\WEB-INF
6) run mvn eclipse:eclipse for making this an eclipse based project
7) add your code
8) run mvn clean install (compile / package)
9) deploy it to your GlassFish domain
10) think about enhancing this with JSF 2.0 ;)