This section covers the build process for tutorials using either the Maven or Ant tools.
These instruction are regarding tool use from the command line, to automate the process using your IDE, see integration.

## Maven

Apache Maven is a popular, convention-over-configuration dependency and build manager; the premier Java project builder. Learn More

1. Navigate to the root directory of the tutorial project. The same directory as 'pom.xml'.
2. Run the command

       mvn package -P servlet

   if building for Tomcat, or

       mvn package -P app

   if building for Glassfish (or another JSF-providing app-server).
3. Maven will begin downloading the dependencies specified in the POM. Once the dependencies have been installed to your local repository, compilation will begin.
4. If compilation finished without error, the prepared application, "example-named-tutorial.war" will be located in the "target" project subdirectory.

## Ant

Ant is a powerful but verbose 'make'-like build tool from Apache. Learn More
Ant requires a configuration of where it's dependencies are located and how to compile the project source folders; stored in this case, in the "common.xml" file. Common.xml is included in the same directory as this README, and is configured by default for builds made in the ICEfaces SVN directory tree. To use Ant independently of this location, the property name named "icefaces.base.dir" must be set to the root of a local ICEfaces distribution.

1. Navigate to the parent directory of the tutorial project. The same directory as "common.xml".
2. Open common.xml and replace the value of the

       <property>

   tag named "icefaces.base.dir" with the path to your local ICEfaces source bundle. If this build is located as part of an ICEfaces bundle, skip this step.
3. Navigate to the tutorial directory. The same directory as "build.xml".
4. Run the command

       ant servlet-profile

   if building for Tomcat, or

       ant web-profile

   if building for Glassfish (or another JSF-providing app-server).
5. Ant will begin copying in dependencies and compiling the source files. If compilation is successful a war file will be generated in ".../tutorial/build/dist/" with the same name as the tutorial directory.

This section covers running the compiled web application on a Java application server.

## Tomcat 6

The current stable version of the most popular Java servlet container. The standard for other Java servers; in fact many heavierweight servers have modified versions of Tomcat at their core somewhere. Learn More

1. Locate the war file you compiled either by yourself or with your IDE.
2. Copy the war file to the "tomcat6/webapps" directory of the server.
3. Run the server. A directory within "webpps" is automatically created with the contents of the war.
4. Navigate to the application-context of your server domain; by default, something like

       http://localhost:8080/a-tutorial-name/

   .

If you recieve a 404 error, check to see if the application includes a index.jsp file, without this default entry point, you might need to access your application pages explicitly in your URL, i.e "...a-tutorial-name/main.jsf"
If problems persist, check to make sure you compiled the tutorial for Tomcat/servlet configurations!

## Glassfish 3

The open source version of the Java enterprise server developed by Oracle; more feature filled than Tomcat, although with accompanying slowdown and complexity. Learn More

1. Locate the war file you compiled either by yourself or with your IDE.
2. Copy the war file to the "glassfish3/domains/domain1/autodeploy" directory of the server.
Alternately you could use the powerful Glassfish console. By default hosted at

    http://locahost:4848/

.
3. Run the server. A directory within "autodeploy" is automatically created with the contents of the war.
4. Navigate to the application-context of your server domain; by default, something like

       http://localhost:8080/a-tutorial-name/

   .

If you recieve a 404 error, check to see if the application includes a index.jsp file, without this default entry point, you might need to access your application pages explicitly in your URL, i.e "...a-tutorial-name/main.jsf"
If problems persist, check to make sure you compiled the tutorial for Glassfish/application-server configurations!
This section covers development environment importing and building of the Maven project definitions included with each tutorial.
If you'd prefer to build using Ant, command-line Ant instructions are provided on the compilation page.
If Maven produces the error "com.thoughtworks.xstream.mapper.CannotResolveClassException", during compilation, perform the "clean" target from the Maven lifecycle and try the original build again. The compiled sources from a previous build were incompatible with the build being attempted.

## Eclipse

Whenever Java IDEs are the topic of discussion, Apache Eclipse is always the first name you hear. Extensible, ubiquitous and competent at it all, it's the #1 IDE choice of Java developers. Learn More

1. Select the "Import..." option from the File menu.
2. Select the import source "Existing Maven Projects" under the Maven category.
3. Click the "Browse..." button following the "Root Directory:" field, and select the folder containing the pom.xml you want to build.
4. Checkoff the pom.xml files you'd like to have converted into projects and click "Finish".
5. Once the build has appear in the "Project Explorer" sidebar, right click on it, and select th target "Maven package" under "Run As" to initiate the build.
By default, the pom.xml builds with dependencies for a servlet-container host, i.e Tomcat. If building for a full-scale application server, like Glassfish, select the target "Maven build..." instead from "Run As", displaying a prompt where you can set the build profile to "app".

## IntelliJ IDEA 10

IDEA is a privately developed, open source Java IDE with wide support of JRE and non-JRE languages, and the best auto-completion and code generation features bar none. Learn More
IDEA has several flexible workflows to build projects from imported Java source trees. The one we'll be demonstrating is the most applicable and lowest-configuration method; letting IDEA interpret the type of Java project via a Maven POM file.

1. Select the "Open Project..." option from the File menu.
2. Navigate the root of the tutorial project and open the pom.xml file.
3. IDEA will scan the POM and interpret that its a web application. Ideally it should also discover it's a JSF project and prompt you to add that facet.
   If the prompt disappears before you get a chance to click it or, it just never shows up, the JSF facet can be easily added. Right clicking the root folder in the "Project" tool window, choosing "Open Module Settings" and clicking the "+" button while the Web facet is selected will display JSF as a possible facet to add.
4. To use Maven on this new project, open the "Maven Projects" tool window, and choose the profile appropriate for your server.
5. Finally, double click the "package" phase, under "lifecycle" in the same tool window to initiate the build.

## NetBeans 6.9

NetBeans is an open-source IDE developed in cooperation with Oracle, formerly Sun Microsystems. It advertises close integration with Oracle technologies, non-JRE languages and a good GUI builder. Learn More

1. Select the "Open Project..." option from the File menu.
2. Navigate to the root of the tutorial project and select the folder containing the pom.xml file before clicking "Open Project". NetBeans will automatically recognize the folder as a usable Maven project.
3. NetBeans now scans the Maven build in detail, creating a Web Application project from it.
4. After the project finishes creation, NetBeans is ready to build it via Maven. To set the build profile, use the list of menu options under Run -> Set Build Configuration. To execute the build, click the hammer icon in the toolbar, or press F11.