14.01.2013 Views

Java EE Development using Rational Application Developer ... - IBM

Java EE Development using Rational Application Developer ... - IBM

Java EE Development using Rational Application Developer ... - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Java</strong> <strong>EE</strong> <strong>Development</strong> <strong>using</strong> <strong>Rational</strong> <strong>Application</strong><br />

<strong>Developer</strong> 7.5.5 and Maven<br />

by Chuck Bridgham, <strong>IBM</strong><br />

Introduction<br />

<strong>IBM</strong>® <strong>Rational</strong>® <strong>Application</strong> <strong>Developer</strong> for WebSphere® 7.5 delivers a wide range of<br />

integrated productivity enhancing tools for building <strong>Java</strong> <strong>EE</strong>, Web service, Portal, and<br />

SOA solutions. Whether you are developing applications <strong>using</strong> the new EJB 3 or JPA<br />

annotation tools, or reviewing existing applications <strong>using</strong> static code analysis, <strong>Rational</strong><br />

<strong>Application</strong> <strong>Developer</strong> is an IDE that integrates tools for designing, developing, testing,<br />

and deploying your applications, effortlessly transitioning developers through the<br />

software lifecycle.<br />

The Apache Maven project has been around for a while, and many users have adopted the<br />

build system’s practices and procedures, but are unsure how to integrate with a powerful<br />

IDE such as <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>.<br />

This article is going to explore the basics of the Maven projects, and how they interact<br />

with their <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> equivalents. We’ll explore some best practices<br />

building a <strong>Java</strong> <strong>EE</strong> 5 application targeting WebSphere <strong>Application</strong> Server 7.0. We’ll also<br />

cover how nested projects can be used in <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>, and what to<br />

watch out for <strong>using</strong> a team SCM system. We’ll briefly cover some open source projects<br />

aimed at automating many of the steps needed to integrate build environments within an<br />

Eclipse-based IDE such as <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>. Finally, we’ll show a<br />

Maven build in action <strong>using</strong> the <strong>Rational</strong> Team Concert build engine, integrated into the<br />

<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> 7.5 environment.<br />

The Maven story<br />

Whether you’re thinking about <strong>using</strong> Maven for the first time, or have been a long time<br />

user, the benefits of the open build framework become quickly apparent. The following<br />

is a very brief overview of Maven; more details are available on the Apache Maven home<br />

page. (http://maven.apache.org/)<br />

Maven assists developers and build coordinators to unify the wide range of build<br />

requirements and standards into one system that is flexible enough for customization<br />

while providing a common API that can be learned once and deployed company wide.<br />

Maven has been available since 2001, and began with the desire to remove some of the<br />

drudgery and duplication around creating ant scripts by specifying standards on simple<br />

project types.<br />

Page 1 of 30


With the addition of Maven plugins, standard build capabilities (goals) can be customized<br />

and expanded. Maven archetypes are used as project templates, making it easy to enable<br />

standards within your organization. The Maven repository not only provides a database<br />

of sharable resources, but also shareable tasks, templates, and scripts.<br />

What additional capabilities does Maven provide over ant?<br />

• Predefined build conventions(or standards)<br />

• Heavy use of defaulting<br />

• Default tasks<br />

• Default project structures<br />

• Smart structured repository system<br />

• Tools for continuous integration<br />

Each Maven project provides a project object model (POM) file that captures<br />

dependencies plus project properties, All of the default values can be overridden, which<br />

adds to the size of the default POM.xml file.<br />

<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> can interact with Maven project structures by<br />

understanding the project design and restrictions. The two tools can co-exist peacefully<br />

with just a few rules and best practices.<br />

Example 1: <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> integration<br />

for Maven projects<br />

Part 1: Maven Sample Projects Explained<br />

For this example, we will take an existing <strong>Java</strong> <strong>EE</strong> 5 application in Maven consisting of<br />

several modules set up in a typical Maven structure, <strong>using</strong> a root project that contains an<br />

EAR, EJB, utility, and servlet folders. We will demonstrate how to integrate these<br />

projects into <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> by creating projects around these existing<br />

folders. This example will show how easy it is to compile, package, and install Maven<br />

projects. This example does not demonstrate server test integration, because this is one of<br />

<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>’s strengths, which allows you to easily deploy and debug<br />

<strong>Java</strong> <strong>EE</strong> applications to different server environments without the extra steps of<br />

packaging and install. This example also does not integrate with any external plugins<br />

such as m2eclipse that assist in the project classpath management based on the Maven<br />

POM. By default, <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> classpath management continues to<br />

rely on static project MANIFEST files that convey the runtime availability of dependent<br />

modules. Changing the POM.XML file will require also changing <strong>Rational</strong> <strong>Application</strong><br />

<strong>Developer</strong>’s dependency management located under each project’s J2<strong>EE</strong> Jar<br />

Dependencies property sheet.<br />

Page 2 of 30


WebSphere <strong>Application</strong> Server provides ant tasks for deployment and server<br />

operations . See the following information center topic:<br />

(http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.we<br />

bsphere.base.doc/info/aes/ae/tovr_ant.html)<br />

These tasks can be integrated <strong>using</strong> the maven-antrun-plugin<br />

.(http://maven.apache.org/plugins/maven-antrun-plugin/)<br />

The Maven project folder layout is standard, and is used to easily inherit properties and<br />

behaviors from parent projects, keeping the leaf module pom.xml very clean.<br />

Page 3 of 30<br />

Figure 1: Maven project layout<br />

This <strong>Java</strong> <strong>EE</strong> 5 application has optional deployment descriptors in both the EJB and EAR<br />

projects. This application will be targeting the WebSphere <strong>Application</strong> Server 7.0<br />

runtime, which will provide the <strong>Java</strong> and <strong>Java</strong> <strong>EE</strong> runtime JAR files for compilation.<br />

WebSphere <strong>Application</strong> Server ships a number of thin client JAR files for standalone<br />

compilation, and are appropriate for installing into a MAVEN repository. More<br />

information on the WebSphere <strong>Application</strong> Server 7 client JAR files is located here:<br />

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websph<br />

ere.base.doc/info/aes/ae/tcli_developthin.html


Earlier versions of WebSphere <strong>Application</strong> Server also provide similar JAR files, and<br />

should always be used to reflect the intended target environment. Here is an example of<br />

installing a couple of these provided JAR files into your local Maven repository <strong>using</strong> the<br />

WebSphere <strong>Application</strong> Server release level to specify the MAVEN artifact version.<br />

mvn install:install-file -<br />

Dfile=D:\<strong>IBM</strong>\SDP\runtimes\base_v7\runtimes\com.ibm.ws.ejb.thinclient_7.0.0.jar -<br />

DgroupId=websphere -DartifactId=com.ibm.ws.ejb.thinclient -Dversion=7.0.0 -<br />

Dpackaging=jar<br />

mvn install:install-file -<br />

Dfile=D:\<strong>IBM</strong>\SDP\runtimes\base_v7\runtimes\com.ibm.ws.jpa.thinclient_7.0.0.jar -<br />

DgroupId=websphere -DartifactId=com.ibm.ws.jpa.thinclient -Dversion=7.0.0 -<br />

Dpackaging=jar<br />

Part 2: Preparing Maven Projects<br />

Our two examples use most of the Maven project packaging and plugin defaults, but<br />

several key properties are set to help integrate into the <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong><br />

workspace environment, and also integrate with the m2e plugins<br />

Looking at the existing EJB project pom.xml file, you will notice the dependency to the<br />

data project containing JPA entity classes, the EJB client JAR file, and the WebSphere<br />

<strong>Application</strong> Server client JAR file. Some plugin properties are also set, such as the EJB<br />

level to 3.0 to allow for an optional deployment descriptor, and specifying the existing<br />

MANIFEST file location to use during maven packaging.<br />

This allows <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> to use a predefined MANIFEST file for its<br />

development time classpath setup, rather than generating at publish time. This is an<br />

important difference with m2eclipse sample shown later, where the MANIFEST is<br />

generated based on the POM file contents.<br />

Page 4 of 30


Page 5 of 30<br />

Listing 1: EJB pom.xml<br />

<br />

4.0.0<br />

root.SampleProject<br />

MyCompanyEJB<br />

ejb<br />

1.0<br />

enterprise java beans<br />

<br />

root<br />

SampleProject<br />

1.0<br />

<br />

<br />

<br />

root.SampleProject.Utilities<br />

DataProject<br />

1.0<br />

<br />

<br />

root.SampleProject.Utilities<br />

MyCompanyEJBClient<br />

1.0<br />

<br />

<br />

<br />

websphere<br />

com.ibm.ws.ejb.thinclient<br />

7.0.0<br />

provided<br />

<br />

<br />

<br />

${project.artifactId}<br />

<br />

<br />

maven-ejb-plugin<br />

<br />

3.0<br />

<br />

<br />

true<br />

<br />

<br />

<br />

<br />

<br />

org.apache.maven.plugins<br />

maven-jar-plugin<br />

<br />

<br />

src/main/java/META-INF/MANIFEST.MF<br />

<br />

<br />

<br />

<br />

<br />

<br />

Next, in the EAR project pom file, include the dependent projects, which are used to<br />

generate an application.xml. In our example for <strong>Java</strong> <strong>EE</strong> 5, we designated this file to be<br />

omitted, and we added this option and EAR plugin version because this is a very new<br />

feature, not available in versions prior to v2.3.2. If this was an EAR with an existing<br />

application.xml file, you must set the applicationXML parameter of the EAR plugin.


More EAR plugin info is available here: http://maven.apache.org/plugins/maven-earplugin/ear-mojo.html#applicationXml<br />

Page 6 of 30<br />

Listing 2: Ear pom.xml<br />

<br />

4.0.0<br />

root.SampleProject<br />

MyCompanyEJBEar<br />

ear<br />

1.0<br />

MyCompanyEJBEar<br />

<br />

root<br />

SampleProject<br />

1.0<br />

<br />

<br />

<br />

root.SampleProject<br />

MyCompanyEJB<br />

ejb<br />

<br />

<br />

root.SampleProject.Utilities<br />

MyCompanyEJBClient<br />

1.0<br />

jar<br />

<br />

<br />

root.SampleProject.Utilities<br />

DataProject<br />

1.0<br />

jar<br />

<br />

<br />

root.SampleProject.servlets<br />

MyCompanyWeb<br />

1.0<br />

war<br />

<br />

<br />

<br />

${project.artifactId}<br />

<br />

<br />

maven-ear-plugin<br />

2.3.2<br />

<br />

5<br />

false<br />

<br />

<br />

true<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

MyCompanyEJBEAR.ear<br />

<br />


The rest of the utility projects are very straight forward, and use an inherited property to<br />

always generate the MANIFEST <strong>using</strong> the existing file in place.<br />

Page 7 of 30<br />

Listing 3: Utility pom.xml<br />

<br />

…<br />

<br />

<br />

org.apache.maven.plugins<br />

maven-jar-plugin<br />

<br />

<br />

src/main/java/META-INF/MANIFEST.MF<br />

<br />

<br />

<br />

<br />

<br />

The servlet's pom file also specifies generating the MANIFEST, and leaving out the<br />

dependent libraries from the WEB-INF/lib directory. This must be specified through the<br />

WAR plugin, with the latest version available.<br />

Listing 4: Servlet pom.xml<br />

<br />

<br />

<br />

org.apache.maven.plugins<br />

maven-war-plugin<br />

2.1-beta-1<br />

<br />

<br />

src/main/java/META-INF/MANIFEST.MF<br />

<br />

true<br />

<br />

<br />

<br />

<br />

<br />

<br />

The parent SampleProject pom.xml is used for global configuration, for example<br />

specifying JRE libraries and compiler levels.


Page 8 of 30<br />

Listing 5: Parent pom.xml<br />

This example also has one third party JAR file that is included in the EAR, to<br />

demonstrate how applications can refer to these libraries. Run a one time install<br />

command to include the third party JAR file in the Maven repository<br />

I have included a zip archive of the sample Maven projects prior to <strong>Rational</strong> <strong>Application</strong><br />

<strong>Developer</strong> integration.<br />

After unzipping, try a couple of maven commands to ensure your environment is set up.<br />

For instance: mvn install<br />

<br />

<br />

<br />

org.apache.maven.plugins<br />

maven-compiler-plugin<br />

<br />

1.6<br />

1.6<br />

<br />

<br />

<br />

<br />

mvn install:install-file -<br />

Dfile=D:\MAVEN\RAD_PROJECTS\SampleProject\MyCompanyEJBEAR\src\main\application\MyCompa<br />

nyUtilities.jar -DgroupId=root.SampleProject.Utilities -DartifactId=MyCompanyUtilities<br />

-Dversion=1.0 -Dpackaging=jar<br />

If all went well, you should see similar output toward the end of the console.<br />

[INFO]<br />

[INFO]<br />

[INFO] ------------------------------------------------------------------------<br />

[INFO] Reactor Summary:<br />

[INFO] ------------------------------------------------------------------------<br />

[INFO] SampleProject ......................................... SUCCESS [7.219s]<br />

[INFO] Utility projects ...................................... SUCCESS [0.344s]<br />

[INFO] logging ............................................... SUCCESS [4.312s]<br />

[INFO] logging ............................................... SUCCESS [0.250s]<br />

[INFO] servlets .............................................. SUCCESS [0.016s]<br />

[INFO] MyCompanyWeb .......................................... SUCCESS [2.281s]<br />

[INFO] enterprise java beans ................................. SUCCESS [0.594s]<br />

[INFO] MyCompanyEJBEar ....................................... SUCCESS [0.922s]<br />

[INFO] ------------------------------------------------------------------------<br />

[INFO] ------------------------------------------------------------------------<br />

[INFO] BUILD SUCCESSFUL<br />

[INFO] ------------------------------------------------------------------------<br />

[INFO] Total time: 16 seconds<br />

[INFO] Finished at: Sun Aug 09 14:21:29 EDT 2009<br />

[INFO] Final Memory: 19M/33M<br />

[INFO] ------------------------------------------------------------------------


Part 3: Understanding <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> project<br />

metadata<br />

Before proceeding with project creation in <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>, let’s identify<br />

the metadata stored by <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> that will help you gain an<br />

understanding of the relationship with Maven metadata, and will prevent build and<br />

synchronization issues between the two.<br />

Simple <strong>Java</strong> projects in <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> are based on the core (JDT)<br />

Eclipse project:<br />

File/Folder Description<br />

.project Simple xml file listing natures and builders<br />

installed on project.<br />

.classpath JDT xml file listing <strong>Java</strong> source and target<br />

folders, JAR and class dependencies in<br />

forms of containers and single entries<br />

settings/.org.eclipse.jdt.core.prefs compiler level, and other <strong>Java</strong> properties<br />

<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> <strong>Java</strong> <strong>EE</strong> projects add more complex metadata to your<br />

project:<br />

Page 9 of 30


File/Folder Description<br />

.settings/org.eclipse.wst.common.project.facet.core.xml XML file that captures more<br />

details regarding the<br />

capabilities of the project, and<br />

the target server runtime<br />

environment<br />

XML file that contains<br />

.settings/org.eclipse.wst.common.component<br />

resource mapping and<br />

dependent library references<br />

defining the “deployed”<br />

module<br />

MANIFEST.MF file In <strong>Rational</strong> <strong>Application</strong><br />

<strong>Developer</strong>, this file is<br />

maintained at development<br />

time, and is also used to<br />

determine project<br />

dependencies. This is different<br />

than Maven, where this file is<br />

generated at packaging time,<br />

based on the pom.xml.<br />

Part 4: Preparing for <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> project<br />

creation<br />

You may notice that I have not included junit tests in the Maven project folders, although<br />

this is perfectly legal. One issue that should be considered is the fact that <strong>Rational</strong><br />

<strong>Application</strong> <strong>Developer</strong> <strong>Java</strong> projects only support a single classpath. Mixing runtime and<br />

test artifacts within the same project may produce undesirable results. Managing the<br />

deployable contents of the module by manually editing the<br />

.settings/org.eclipse.wst.common.component file can be messy. Therefore, it is<br />

recommended to create separate test projects to hold junit tests, depending on your<br />

runtime artifacts.<br />

<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> has several workspace project preferences that can be set<br />

to mimic a Maven structure, and can be shared across your organization. Under the menu<br />

Window> Preferences, select the <strong>Java</strong> <strong>EE</strong> > Project preference page. Use the<br />

following MAVEN defaults:<br />

Page 10 of 30


Page 11 of 30<br />

Figure 2: <strong>Java</strong> <strong>EE</strong> Project preferences


Dependency synchronization<br />

This example works because both <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> and Maven are created<br />

with parallel steps, carefully creating entries in each respective dependency mechanisms.<br />

Maven uses pom.xml, and <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> uses a combination of<br />

MANIFEST.MF, and component metadata driven by the project properties defined in<br />

<strong>Java</strong> <strong>EE</strong> Module Dependencies. Any changes to a project dependency must be<br />

maintained in both mechanisms in this scheme.<br />

Part 5: Creating <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> Projects<br />

As mentioned previously, <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> <strong>Java</strong> projects only support a<br />

single classpath, and a project should be created for each deployable unit to properly<br />

emulate the runtime environment. When creating projects in <strong>Rational</strong> <strong>Application</strong><br />

<strong>Developer</strong> that overlay existing file structures, it is important to start from the parent<br />

projects down. We will start with our root project, creating a simple non-<strong>Java</strong> project that<br />

captures this Maven project. Be careful to clear the Use default location check box, and<br />

use the same folder location under the Maven directories:<br />

Page 12 of 30<br />

Figure 3: Simple Project creation


Next create the two container projects servlets and Utilities <strong>using</strong> the same project<br />

wizard, but carefully selecting the correct subfolder:<br />

Figure 4: Servlet project creation<br />

Page 13 of 30


Page 14 of 30<br />

Figure 5: Utility project creation


Next we will create the EJB project MyCompanyEJB, selecting the correct folder<br />

location, and also clearing the Add project to an EAR check box. Select module version<br />

3.0, and always select the Target Runtime WebSphere <strong>Application</strong> Server v7.0 for our<br />

example projects.<br />

Page 15 of 30<br />

Figure 6: EJB project creation


Next we’ll create the EAR project: MyCompanyEJBEAR, choosing the correct<br />

location:<br />

Page 16 of 30<br />

Figure 7: Ear project creation


Next we’ll create the JPA project DataProject, carefully specifying the correct folder<br />

location, from the New > Project > <strong>Java</strong> <strong>EE</strong> > JPA Project wizard, also clearing the<br />

“Add project to an EAR” checkbox and unselecting “Create orm.xml”<br />

Page 17 of 30<br />

Figure 8: JPA project creation


Page 18 of 30<br />

Figure 9: JPA Facet Settings


The next step is the EJB client project MyCompanyEJBClient. Carefully specify the<br />

correct folder location, from the New > Project > <strong>Java</strong> <strong>EE</strong> > Utility wizard, also<br />

clearing the Add project to an EAR check box.<br />

.<br />

Page 19 of 30<br />

Figure 10: EJB Client project creation


The last project to be created is the Web project MyCompanyWeb. Select the menu<br />

New > Project > Web > Dynamic Web Project , carefully specifying the correct folder<br />

location, also clearing the Add project to an EAR checkbox. Click Next. Clear the<br />

Generate Deployment Descriptor check box and then click Finish.<br />

Page 20 of 30<br />

Figure 11: Web project creation


Next we’ll add the projects to the EAR project by right-clicking the project and selecting<br />

the Properties > <strong>Java</strong> <strong>EE</strong> Module Dependencies, and checking each project listed (4).<br />

Page 21 of 30<br />

Figure 12: Configuring Ear


The last step is to add the JPA DataSource configuration to the WebSphere <strong>Application</strong><br />

Server configuration file. This is done by right-clicking the DataProject and selecting<br />

JPA Tools > Configure Project For JDBC Deployment.<br />

In the Enterprise Explorer view, select the DepartmentSalarySearch servlet. Rightclick<br />

and select Run as > Run on Server.<br />

Page 22 of 30<br />

Figure 13: Test the application


You’re done!<br />

Page 23 of 30<br />

Figure 14: Result page


Maven Eclipse Plugins<br />

Choices exist now for several open source projects that assist with integrating Maven<br />

metadata (POM) and goals with the <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> infrastructure.<br />

• Apache Maven Eclipse plugin (one time creation of Eclipse project metadata<br />

based on the project POM) http://maven.apache.org/plugins/maven-eclipseplugin/<br />

• M2Eclipse http://m2eclipse.sonatype.org/index.html (Eclipse incubator)<br />

• Integration for Apache Maven (IAM) http://www.eclipse.org/iam/ – (Eclipse<br />

incubator)<br />

Of these choices, the m2eclipse project is the most mature, and is gaining popularity<br />

among developers. The project currently has a 0.10.0 release, and is compatible with the<br />

<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> Eclipse base under v7.5.5.x. These plugins offer a wide<br />

variety of tools and integration points including:<br />

• custom builders that are based on the Maven build<br />

• <strong>Java</strong> “containers” that populate the classpath based on the POM library<br />

dependency resolution,<br />

• POM editors that aid in creation/editing and validation of these files<br />

• creation wizards helping create new projects based on archetypes<br />

• Maven command menu actions.<br />

These options are not supported officially by <strong>IBM</strong>, but have active newsgroups and<br />

mailing lists responsive to questions and issues that may arise.<br />

M2 Update site:<br />

Stable releases - http://m2eclipse.sonatype.org/sites/m2e<br />

Page 24 of 30


Page 25 of 30<br />

Figure 15: m2eclipse update sites<br />

Open Help > Software Updates and click the Available Software tab. Add the M2<br />

update site noted above. In addition – before installing, make sure you also have the<br />

GEF update site (http://download.eclipse.org/tools/gef/updates/releases/) and select under<br />

GEF SDK 3.4.2(compatible with <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> 7.5.5) the Zest<br />

Visualization Toolkit.<br />

The m2eclipse integration can further enhance the “overlay” sample in <strong>Rational</strong><br />

<strong>Application</strong> <strong>Developer</strong> by recognizing the Maven project’s POM file, and contributing<br />

directly to the project’s classpath. There will be duplication on the classpath because<br />

<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> calculates the classpath based on the runtime structure<br />

(MANIFEST and JAVA <strong>EE</strong> “lib” folder contents).<br />

Select all the projects, and select from the pop-up menu Maven> Enable Dependency<br />

Management. You will notice added capability to the project.<br />

More details of all these solutions can be found below in the resources section.


SCM integration<br />

Sharing Maven projects requires some understanding of the requirements, or<br />

functionality <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> provides in the build lifecycle. <strong>Rational</strong><br />

<strong>Application</strong> <strong>Developer</strong> integrates with many SCM systems such as <strong>IBM</strong> <strong>Rational</strong><br />

Clearcase and <strong>IBM</strong> <strong>Rational</strong> Team Concert. In our example, we will use the CVS client<br />

to demonstrate sharing our projects in <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>, and how to<br />

handle physically nested projects, which is the case for the <strong>Rational</strong> <strong>Application</strong><br />

<strong>Developer</strong> workspace on the Maven machine, but not all developers will need to nest<br />

projects (or have a local Maven repository installed), and can check out projects as folder<br />

siblings. Within <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>, the CVS tools allow initially sharing<br />

these projects <strong>using</strong> a single root, but not nested in the same Maven folder structure. This<br />

requires “ignoring” the nested structures within a composite project. The Team > Share<br />

Project wizard allows creation of the .cvsignore before the initial commit takes place.<br />

For instance, the two utility projects (DataProject and MyCompanyEJBClient) have<br />

already been shared, and the composite project Utilities is now being shared. Selecting<br />

the nested resources and adding to the .cvsignore file will ensure resources are shared<br />

once.<br />

Page 26 of 30


Page 27 of 30<br />

Figure 16: Sharing projects


<strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> – <strong>Rational</strong> Team Concert<br />

– Maven integration<br />

<strong>Rational</strong> Team Concert is a collaborative software delivery environment that helps teams<br />

to simplify, automate and govern software delivery, and is easily integrated into <strong>Rational</strong><br />

<strong>Application</strong> <strong>Developer</strong> 7.5 <strong>using</strong> the <strong>IBM</strong> Installation Manager option shown below<br />

Page 28 of 30<br />

Figure 17: Installation Manager setting<br />

<strong>Rational</strong> Team Concert includes its own build engine, but also supports many build<br />

platforms such as <strong>IBM</strong> <strong>Rational</strong> BuildForge and Maven. To use these build systems, the<br />

<strong>Rational</strong> Team Concert client must be connected to a <strong>Rational</strong> Team Concert server and<br />

also use the Build System Toolkit.<br />

Download required prerequisites<br />

If you don’t have a server available, free and trial options are available at the Jazz.net<br />

download site:<br />

(Version 1.0.1.1 (Express-C) was used in this demo) https://jazz.net/downloads/rationalteam-concert/releases/1.0.1.1/<br />

Follow the instructions on how to set up the server and build system toolkit<br />

https://jazz.net/downloads/rational-teamconcert/releases/1.0.1.1?p=install.docs/install_server<br />

Creating a Maven build<br />

In your <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> workspace, find the Team Artifacts view, and<br />

expand your project area. Select the builds node, and click New Build Definition. Next<br />

select your team area to associate with the build. Type an ID for the build definition. I<br />

used Test RTC Team Build. Select the Maven - Jazz Build Engine template, and click<br />

Finish. The build definition editor opens. On the General page, in the Supporting Build<br />

Engines section, click Create Engine. Type an engine ID such as "MyBuild". On the<br />

Maven page, enter the project location, goals, and Maven home. My entries are shown in<br />

Figure 18.<br />

Save and close the editor.


Page 29 of 30<br />

Figure 18: Setting up Maven build<br />

Starting the Build Engine<br />

To run Maven builds through <strong>Rational</strong> Team Concert in <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong>,<br />

you must start the Jazz Build Engine. This is required because this process will “listen”<br />

for build requests. In this example, we will run it on our local machine.<br />

1. Open a command prompt or shell.<br />

2. cd to installdir/buildsystem/buildengine/eclipse.<br />

3. Run the following command:<br />

jbe -repository address -userId you -pass your_password -engineId<br />

MyBuild -sleeptime 1<br />

Running a Maven build<br />

1. In the definition editor header, click the Request Build button.<br />

2. In the Request Build dialog, click Submit.<br />

3. See Results in Builds Tab.<br />

Figure 29: Build results<br />

These details and more are located on the Jazz wiki site:<br />

https://jazz.net/wiki/bin/view/Main/MavenBuild


Resources<br />

• Maven Home: http://maven.apache.org/<br />

• WebSphere <strong>Application</strong> Server information center:<br />

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.<br />

websphere.base.doc/info/welcome_base.html<br />

• <strong>Rational</strong> <strong>Application</strong> <strong>Developer</strong> information center:<br />

http://publib.boulder.ibm.com/infocenter/radhelp/v7r5/index.jsp<br />

• M2eclipse Home: http://m2eclipse.sonatype.org/<br />

• M2eclipse project wiki: http://docs.codehaus.org/display/M2ECLIPSE/Home<br />

• <strong>Rational</strong> Team Concert Home: http://jazz.net/<br />

About the author:<br />

Chuck Bridgham is the lead architect and development manager of the <strong>Rational</strong> J2<strong>EE</strong><br />

Tools team at the <strong>IBM</strong> Raleigh Lab. This team is responsible for the core developer tools<br />

involved with creating, editing, and assembling <strong>Java</strong> <strong>EE</strong> artifacts. Chuck has been an<br />

integral member of many product teams foc<strong>using</strong> on data, object persistence and <strong>Java</strong> <strong>EE</strong><br />

technologies. Chuck is also the project lead for <strong>Java</strong> <strong>EE</strong> Tools on the Eclipse Web Tools<br />

Platform. He can be reached at cbridgha@us.ibm.com.<br />

Page 30 of 30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!