Home > Articles > Programming

  • Print
  • + Share This
Like this article? We recommend

web Project

The web project is very similar to the util project listed above. The project.xml is as follows:

<project>
 <extend>../common/project.xml</extend>
  <name>Web Interface</name>
  <artifactId>web</artifactId>
  <shortDescription>Web Interface for the application</shortDescription>

  <dependencies>
   <dependency>
    <groupId>${pom.groupId}</groupId>
    <artifactId>ejb</artifactId>
    <version>${pom.currentVersion}</version>
    <type>ejb</type>
   </dependency>
   <dependency>
    <groupId>${pom.groupId}</groupId>
    <artifactId>util</artifactId>
    <version>${pom.currentVersion}</version>
    <properties>
     <war.bundle>true</war.bundle>
    </properties>
   </dependency>
  </dependencies>
</project>

The primary difference in this project.xml is the inclusion of a couple of dependencies. The web interface sits in front of the EJBs and utilizes classes from the util project, so it is dependent on both of these projects. In the dependencies section, I defined these dependencies so that they will be added to the classpath when this project is compiled. Of note is the <version> tag for each of these dependencies. Instead of setting the version myself (and invariably forgetting to change it later), I referenced the currentVersion number of the common project, which avoids the accidental inclusion of the wrong version in the dependency list.

I also used the groupId from the common/project.xml file instead of setting it explicitly in this project. In the event of a name change of the groupId, it will be changed throughout the project.

The maven.xml file is as simple as the one for the util project:

<project default="example:build">
 <goal name="example:build" prereqs="war:install"/>
</project>

One additional file is required for the war:install goal to work properly. The war plug-in requires a setting to know where the web application files are located. This setting is stored in the project.properties file:

maven.war.src=src/webapp

Unlike the util project, this project is not ready to be built yet because it is dependent on the ejb project.

  • + Share This
  • 🔖 Save To Your Account