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:
<build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
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:
- src/main/resources
- src/test/java
- src/test/resources
5. To automatically manage JEE specification library version numbers, add the JEE 6 specification dependency management BOM to the pom.xml file:
<dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>3.0.0.Beta1</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
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:
- cdi-api
- jboss-annotations-api_1.1_spec
- jboss-jaxrs-api_1.1_spec
- hibernate-jpa-2.0-api
- jboss-ejb-api_3.1_spec
- jboss-transaction-api_1.1_spec
- jboss-jsf-api_2.1_spec
- jboss-servlet-api_3.0_spec
- jboss-jaxb-api_2.2_spec
- hibernate-validator
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:
<plugin> <groupId>org.jboss.as.plugins</groupId> <artifactId>jboss-as-maven-plugin</artifactId> <version>7.1.0.Beta1b</version> </plugin>
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.
About the author
Browse by channel
Automation
The latest on IT automation that spans tech, teams, and environments
Artificial intelligence
Explore the platforms and partners building a faster path for AI
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
Explore how we reduce risks across environments and technologies
Edge computing
Updates on the solutions that simplify infrastructure at the edge
Infrastructure
Stay up to date on the world’s leading enterprise Linux platform
Applications
The latest on our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Developer resources
- Customer support
- Red Hat value calculator
- Red Hat Ecosystem Catalog
- Find a partner
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit