<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xml:id="developerguide.building" xml:lang="en"
         xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:svg="http://www.w3.org/2000/svg"
         xmlns:mml="http://www.w3.org/1998/Math/MathML"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns:db="http://docbook.org/ns/docbook">
  <info>
    <title>Building JOnAS From Source.</title>
  </info>

  <section>
    <info>
      <title>Requirements</title>
    </info>

    <section>
      <info>
        <title>JDK</title>
      </info>

      <para>A <link
      xlink:href="http://java.sun.com/javase/downloads/index_jdk5.jsp">Java SE
      5</link> is required to build JOnAS. Make sure that the JDK used to
      build JOnAS is compliant with the new Java 5 features.</para>
    </section>

    <section>
      <info>
        <title>Maven</title>
      </info>

      <para>The maven tool is used with <filename>pom.xml</filename> files to
      build JOnAS. This tool is available at <link
      xlink:href="http://maven.apache.org">http://maven.apache.org</link>. The
      2.0.7 or later version is recommanded</para>
    </section>
  </section>

  <section>
    <info>
      <title>Optional Requirements</title>
    </info>

    <section>
      <info>
        <title>Eclipse</title>
      </info>

      <para>The JOnAS project provides .project and .classpath for Eclipse 3.1
      or greater. A project is ready to use once the source has been imported
      using the Eclipse tool. Eclipse tool is available at <link
      xlink:href="http://www.eclipse.org">http://www.eclipse.org</link>.</para>
    </section>

    <section>
      <info>
        <title>Eclipse Plugins</title>
      </info>

      <section>
        <info>
          <title>Checkstyle Plugin</title>
        </info>

        <para>The eclipse-checkstyle plugin is used to check the javadoc of
        JOnAS project. A warning will print if the JOnAS coding convention is
        not used. This plugin is available at <link
        xlink:href="http://eclipse-cs.sourceforge.net">http://eclipse-cs.sourceforge.net</link>.</para>
      </section>

      <section>
        <info>
          <title>AnyEdit Plugin</title>
        </info>

        <para>As part of the JOnAS coding convention, the use of tabulation
        characters is disallowed. Files should contain only spaces. The
        AnyEdit plugin allows tabs to be converted to spaces when saving the
        file. Also, trailing spaces can be removed automatically.</para>

        <para>This plugin is available at <link
        xlink:href="http://andrei.gmxhome.de/anyedit/">http://andrei.gmxhome.de/anyedit/</link>.</para>
      </section>

      <section>
        <info>
          <title>Maven 2 plugin</title>
        </info>

        <para>To compile JOnAS under eclipse, use m2eclipse plugin available
        at <link
        xlink:href="http://m2eclipse.codehaus.org/">http://m2eclipse.codehaus.org/</link>.</para>
      </section>

      <section>
        <info>
          <title>Subversion plugin</title>
        </info>

        <para>JOnAS uses subversion as revision control system. The use of
        stable version of Subversive is advised. This plugin is available at
        <link
        xlink:href="http://www.polarion.org/index.php?page=overview&amp;project=subversive.">http://www.polarion.org/index.php?page=overview&amp;project=subversive.</link></para>
      </section>
    </section>
  </section>

  <section>
    <info>
      <title>Compiling JOnAS</title>
    </info>

    <para>To compile JOnAS, launch the command <command>mvn</command> in the
    root directory of the project (named JOnAS by default) being
    launched.<note>
        <para>The default maven goal is install if not specified.</para>
      </note></para>

    <para>Once the command has been run successfully, the maven artifacts
    generated by maven are available in the maven local repository. The
    <filename class="directory">target</filename> directories contain the
    generated jars or assemblies.<note>
        <para>Bundles that are used in <command>jonas </command>command, must
        be updated manually from local repository to <varname>$JONAS_ROOT/lib
        </varname>directory if they have been modified. Please refer to
        <varname>$JONAS_ROOT/bin </varname>for available commands.</para>
      </note></para>

    <para><command>mvn clean install</command> is used to clean and regenerate
    classes.</para>
  </section>

  <section>
    <info>
      <title>Maven assembly</title>
    </info>

    <para>JOnAS build generates several assemblies. Assemblies are located in
    the <filename class="directory">assemblies</filename> folder.</para>

    <section>
      <info>
        <title>End-User assembly</title>
      </info>

      <para>The assembly contains examples and is available with the zip or
      tgz format in the <filename
      class="directory">assemblies/jonas-osgi/target</filename> folder. The
      unzipped assembly folder should directly be used as<code>
      <varname>$JONAS_ROOT.</varname> </code>Moreover, the
      <varname>/lib</varname> directory of this <varname>$JONAS_ROOT</varname>
      contains all the bundles of the assembly.</para>

      <note>
        <para>Lauchning JOnAS in developper mode (see <xref
        linkend="developerguide.running" />) will set the use of bundles
        stored in maven local repository.</para>
      </note>

      <para>A common way to set JONAS_ROOT is to make a symbolic link (linux
      only) on the directory : <para>
          <command>ln -s
          .../assemblies/jonas-osgi/target/jonas-osgi-...-bin.dir/jonas-osgi-...
          <emphasis>your_jonas_root_path</emphasis></command>
        </para></para>

      <para>You can alternatively copy all this tree under your target
      JONAS_ROOT directory.</para>
    </section>
  </section>
</section>
