Run your first Java EE application with JBoss EAP 7 Beta
This article describes how efficient development is on JBoss EAP 7. It will also give example of different build tools and Integrated Development Environments (IDEs) to use for application development on JBoss EAP 7. Additionally it will briefly explain how dependency management works for Java EE 7 and JBoss EAP specific artifacts.
Finally there is a step-by-step guide that demonstrates how fast and efficient it is to develop on JBoss EAP 7.
If you don’t like to read such a long article you can also watch the 7 min screen cast. Just grab a coffee and sit back and relax while I’ll talk you through how to run your first Java EE application using JBoss EAP 7 Beta.
=I will cover dependency management in more detail in a future article.
Today the most common build tool for Java and Java EE development is Maven. Maven is also the preferred tool for building applications for JBoss EAP 7, both the quickstarts and the example application that are provided use maven. Additionally JBoss EAP 7 ships with Maven plugins that can deploy and undeploy your application as well as configure JBoss EAP 7 using the CLI commands. This makes it possible to automatically deploy not only an applications, but also configuration to a running instance of JBoss EAP 7. For example as part of you project you may configure a datasource or a JMS queue.
Which build tool a developer or organization use depends on external factors like, environment, complexity, previous experience, and personal preferences. JBoss EAP does not mandate a particular build tool and as long as it supports Java and can produce valid Java EE artifacts such as Java Archives, Web Archives, etc it can be used to build applications for JBoss EAP.
Example on other popular build tools are Ant and Gradle. Optionally Ant users may also use Ivy to manage dependencies.
Integrated Development Environment
The choice of Integrated Development Environment, if any, also depends on external factors. IDE’s typically has built-in tools for syntax checks, unit testing, and starting and stopping an Application Server like JBoss EAP. The really smart IDE’s also provides features like LiveReload, which automatically reloads the application when a resource that is part of the application is updated. Red Hat provides a free IDE called JBoss Developer Studio which is based on Eclipse and has powerful features for developing on JBoss EAP 7.
Examples on other commonly used IDEs for developing on JBoss EAP are:
- Eclipse for Java EE Developers
- IntelliJ from JetBrains
When building Java Applications developers typically use different frameworks and libraries that provides additional features. This is especially true for Java EE development. In an ideal world all Java EE application would use only the APIs that are provided as part of the Java EE standard. And since JBoss EAP 7 is a certified Java EE 7 platform any application build using the Java EE 7 standard are supported. However in reality developers sometimes have to use other third-party frameworks or proprietary APIs. For a developer it may be hard to know which libraries and version that are supported as part of JBoss EAP. Therefor it’s recommended to use the maven repository that Red Hat provides.
The maven repository for JBoss EAP 7 is provided both online, where dependencies are downloaded at build time, or as downloadable ZIP files that can be saved locally or in a hosted maven repository. To access the online repository go to http://maven.repository.redhat.com. Please note that for JBoss EAP 7 Beta the maven repository is hosted under the early access repository.
For an example on how to use the online repository see the quickstarts that is provided with JBoss EAP 7.
1. Install required Software
For more details check out http://developerblog.redhat.com/2016/01/20/screen-cast-getting-started-with-jboss-eap-7-beta/
- Java Development Kit (OpenJDK or Oracle JDK is recommended)
- JBoss Enterprise Appication Server 7 Beta
- JBoss Developer Studio 9.0 or later
2. Import a the Kitchensink quickstart project
Type maven in the filter text input and select Existing Maven Projects`
And browse to where you have unzipped the quickstart and select the Kitchensink sub directory. Click OK and click Finish`.
3. Change and deploy the application
If you don’t have a server configured you will have to add it. See the video for details on how to add the server.
After only a few seconds the server will start.
To verify that it works we can open the application in an Internal Web Browser directly in JBoss Developer Studio by right clicking on the Deployment in the Server View and select Show In -> Web Browser.
Now the application is displayed in the intern web browser in JBoss Developer Studio so the developer doesn’t even have to leave the IDE to verify that change.
4. Live Reload
If a developer does hundreds or even thousands of changes in a day even a couple of seconds to test and verify quickly adds up to allot of wasted time waiting for deployment. JBoss Developer Studio has a feature called Live Reload that automatically pushes any changed resources directly to JBoss EAP making it possible to verify immediately.
To enable LiveReload, right click on the deployment in the server view and select Show In -> Web Browser via LiveReload Server.
To summarize JBoss EAP 7 is a very flexible application server and combined with a IDE like JBoss Developer Studio Java EE 7 development becomes super efficient.
For more information about JBoss EAP 7 please visit http://developers.redhat.com/products/eap and for more information about JBoss Developer Studio please visit http://developers.redhat.com/products/devstudio.
Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.