Java Reference
In-Depth Information
<artifactId>
<artifactId> junit </artifactId>
</artifactId>
<version>
<version> 4.1 </version>
</version>
<scope>
<scope> test </scope>
</scope>
</dependency>
The junit dependency has a scope of test . This means that this library is only used to run
the tests and therefore does not need to be included within the WAR. If you were building
this WAR file to be deployed on the JBoss or Wildfly application servers, you would not
want to include all of these RESTEasy dependencies within the WAR file. This is because
these application servers already come with JAX-RS preinstalled. In this case, you would
define a scope of provided for each of the other dependencies listed in this file. For ex-
ample:
<dependency>
<dependency>
<groupId>
<groupId> org.jboss.resteasy </groupId>
</groupId>
<artifactId>
<artifactId> resteasy-jaxrs </artifactId>
</artifactId>
<version>
<version> 3.0.5.Final </version>
</version>
<scope>
<scope> provided </scope>
</scope>
</dependency>
The provided scope tells Maven that this is a dependency that is needed to compile your
code, but that the environment in which you will deploy this WAR already includes the de-
pendency.
OK, now that we've got that covered. Let's look at the rest of our pom.xml file:
<build>
<build>
<finalName>
<finalName> ex03_1 </finalName>
</finalName>
The build element contains configuration information related to how Maven should build
our project. The first item we have under this section is the finalName element. This ele-
ment overrides the default file naming conventions of Maven. Here we're stating that we
want our WAR file to be named ex03_1.war .
Next we have the plugins element. This section defines the configuration for the Maven
plug-ins that will be used to build the project:
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>
<groupId> org.apache.maven.plugins </groupId>
</groupId>
<artifactId>
<artifactId> maven-compiler-plugin </artifactId>
</artifactId>
<configuration>
<configuration>
<source>
<source> 1.6 </source>
</source>
<target>
<target> 1.6 </target>
</target>
Search WWH ::




Custom Search