Applications utilizing the IBM JAX-RS runtime can be packaged using a provided ant script. The buildWar.xml is included in the distribution under the ${IBM_JAXRS_HOME}/resources directory. Optionally, if using a WebSphere Application Server stand-alone configuration, the ant script can be invoked to include installing the packaged WAR.
Copy the buildWar.xml provided in the IBM JAX-RS distributables to the root level of the project.
If you are using Eclipse, you can import the build script using by right-clicking on the project folder and going to "Import...". On the next panel select "File System" as the input type and click "Next". Browse to the resources directory within your IBM JAX-RS distribution folder and import the buildWar.xml file.
If you are using a command-line environment, you can simply copy the buildWar.xml from the distribution folder to the root of your development folder.
Edit the project specific properties in the build script.
There are four properties that must be modified in the buildWar.xml
Property | Description |
---|---|
build.dir | The directory that contains the compiled .class files for the project. These .class files will be put into the WEB-INF/classes directory of the created WAR. |
ibm.jaxrs.home | The directory that contains the expanded IBM JAX-RS distributables. |
application.class | The javax.ws.rs.core.Application subclass that is provided by the application. |
war.name | The name of the WAR that is created. |
When utilizing the script to install to a WebSphere Application Server configuration, there are two additional properties that must be supplied
Property | Description |
---|---|
profile.root | The path to the WebSphere Application Server profile for your configuration. |
context.root | The context root to which the WAR will be deployed. |
Consider the case where the project has the following property values:
The build.xml would be updated as follows:
|
If you do not intend to install the packaged WAR to a WebSphere Application Server configuration, simply run the "ant" command after the preceding properties have been set. A WAR with the supplied name will be created in the same directory of the buildWar.xml file.
If you do intend to install the packaged WAR to a WebSphere Application Server configuration, run the "ant installToWAS" command after the preceding properties have been set. A WAR with the supplied name will be created in the same directory of the buildWar.xml file, and the WAR will be installed to the indicated WebSphere Application Server configuration.
The script can also be run from within Eclipse by right-clicking on the buildWar.xml and click Run As > Ant Build.