by Jim Rigsbee (Red Hat)
Converting a web project generated by the JBoss Developer Studio CDI Web Project wizard to a Maven project will give you the power of the Maven build system with its dependency management, build life cycles, and automated JEE packaging abilities. To covert a JBoss Developer Studio web project, follow these steps:
1. Right click on the project name in the Project Explorer tree and select Configure → Convert to Maven Project... In the wizard steps be sure to select WAR packaging.
2. Configure the Java SE 6 compiler plugin so that we can process annotations. Add this to pom.xml file:
3. Move the contents of the WebContent to the src/main/webapp folder. Delete the WebContent folder.
4. Create or convert source folder to src/main/java. Based on your project's needs and existing code you may also need to add or convert:
5. To automatically manage JEE specification library version numbers, add the JEE 6 specification dependency management BOM to the pom.xml file:
6. Generate a model Maven project so that you can borrow the dependencies: Use JBoss Central and pick the Java EE Web Project:
7. Copy the JEE 6 specification dependencies from the model project pom.xml to your project's pom.xml. Based on your project's needs consider including these artifacts:
8. Right click on the project name in the Project Explorer and select Maven → Update Project Configuration...
9. Consider adding the JBoss AS plugin so that you can deploy to JBoss EAP with Maven. Add the following to the plugins section of the pom.xml file:
Now you can develop, build, and deploy inside the JBoss Developer Studio as well as build from the command line. Make sure you have the JBOSS_HOME environment variable set to the installation directory of JBoss EAP. Use the following Maven command to build and deploy your application:
mvn package jboss-as:deploy
In the all-new JBoss Enterprise Application Development (JB225) course, students will learn more about JBoss Developer Studio tools.
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.