<!--
  ~ Copyright 2009 the original author or authors.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<chapter id="getting_started">
<title>Getting Started</title>

<section>
    <title>Prerequisites</title>

    <para>Gradle requires a Java JDK to be installed. Gradle ships with its own Groovy library, therefore no Groovy
        needs to be installed. Any existing Groovy installation is ignored by Gradle. The standard Gradle distribution
        requires a JDK 1.5 or higher. We also provide a distinct JDK 1.4 compatible distribution.
    </para>

    <para>Gradle uses whichever JDK it finds in your path (to check, use <userinput>java -version</userinput>).
        Alternatively, you can set the <envar>JAVA_HOME</envar> environment variable to point to the install directory
        of the desired JDK.
    </para>
</section>

<section>
<title>Unpacking</title>

<para>The Gradle distribution comes packaged as a zip. The distribution contains:</para>

<itemizedlist>
    <listitem><para>The Gradle binaries.</para></listitem>
    <listitem><para>The user guide (HTML and PDF).</para></listitem>
    <listitem><para>The API documentation (Javadoc and Groovydoc).</para></listitem>
    <listitem>
        <para>Extensive samples, including the examples referenced in the user guide, along with some complete and more
            complex builds you can use the starting point for your own build.
        </para>
    </listitem>
    <listitem>
        <para>The binary sources (If you want to build Gradle you need to download the source distribution or checkout
            the sources from the source repository).
        </para>
    </listitem>
</itemizedlist>

<note>
<title>For Un*x users</title>

<para>You need a GNU compatible tool to unzip Gradle, if you want the file permissions to be properly set. We mention this as
some zip front ends for Mac OS X don't restore the file permissions properly.
</para>
</note>
</section>

<section>
<title>Environment variables</title>

<para>For running Gradle, add <filename><replaceable>GRADLE_HOME</replaceable>/bin</filename> to your <envar>PATH</envar>
    environment variable. Usually, this is sufficient to run Gradle. Optionally, you may also want to set the
    <envar>GRADLE_HOME</envar> environment variable to point to the root directory of your Gradle installation.
</para>
</section>

<section>
<title>Running and testing your installation</title>

<para>You run Gradle via the <command>gradle</command> command. To check if Gradle is properly installed just type
<command>gradle -v</command> and you should get an output like:
</para>

<screen>
------------------------------------------------------------
Gradle 0.7
------------------------------------------------------------

Gradle buildtime: Saturday, July 18, 2009 10:10:44 PM CEST
Groovy: 1.6.3
Ant: Apache Ant version 1.7.0 compiled on December 13 2006
Ivy: 2.1.0-rc2
Java: 1.5.0_19
JVM: 1.5.0_19-137
JVM Vendor: Apple Inc.
OS Name: Mac OS X
</screen>

</section>

<section>
<title>JVM options</title>

<para>JVM options for running Gradle can be set via environment variables. You can use <envar>GRADLE_OPTS</envar>
or <envar>JAVA_OPTS</envar>. Those variables can be used together. <envar>JAVA_OPTS</envar> is by convention an environment
variable shared by many Java applications. A typical use case would be to set the HTTP proxy in <envar>JAVA_OPTS</envar>
and the memory options in <envar>GRADLE_OPTS</envar>. Those variables can also be set at the beginning
of the <command>gradle</command> or <command>gradlew</command> script.
</para>

</section>

<standalonedocument>
<section>
<title>Getting help</title>

<para>You might check the user guide at <filename><replaceable>GRADLE_HOME</replaceable>/docs/userguide/userguide.html</filename>.
Typing <command>gradle -h</command> prints the command line help. Typing <command>gradle -t</command> shows all the
tasks of a Gradle build.
</para>

</section>
</standalonedocument>

</chapter>
