<commit_before><!--
  ~ Copyright 2011 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='application_plugin'>
    <title>The Application Plugin</title>
    <para>The Gradle application plugin extends the language plugins with common application related tasks.
    It allows running and bundling applications for the jvm by creating a jvm application <apilink class="org.gradle.api.distribution.Distribution" />.
    </para>

    <section>
        <title>Usage</title>
        <para>To use the application plugin, include the following in your build script:</para>
        <sample id="useApplicationPlugin" dir="application" title="Using the application plugin">
            <sourcefile file="build.gradle" snippet="use-plugin"/>
        </sample>
        <para>To define the main-class for the application you have to set the <literal>mainClassName</literal> property as shown below</para>
        <sample id="useApplicationPlugin" dir="application" title="Configure the application main class">
            <sourcefile file="build.gradle" snippet="mainClassName-conf"/>
        </sample>

        <para>Then, you can run the application by running <userinput>gradle run</userinput>. Gradle will take care of building the application classes,
            along with their runtime dependencies, and starting the application with the correct classpath.
            You can launch the application in debug mode with <userinput>gradle run --debug-jvm</userinput> (see <apilink class="org.gradle.api.tasks.JavaExec" method="setDebug(boolean)" />).
        </para>

        <para>The plugin can also build a distribution for your application. The <apilink class="org.gradle.api.distribution.Distribution" /> will package up the runtime dependencies of the application
            along with some OS specific start scripts. All files stored in <filename>src/dist</filename> will be added to the root of the
            distribution. You can run <userinput>gradle installDist</userinput> to create an image of the application in
            <filename>build/install/<replaceable>projectName</replaceable></filename>. You can run <userinput>gradle assemble</userinput> to create a
            ZIP containing the distribution or <userinput>gradle assemble</userinput> to build the application ZIP and application TAR.
        </para>

        <para>
            If your Java application requires a specific set of JVM settings or system properties, you can configure the <literal>applicationDefaultJvmArgs</literal> property.
            These JVM arguments are applied to the <literal>run</literal> task and also considered in the generated start scripts of your distribution.
        </para>
        <sample id="configureApplicationDefaultJvmArgs" dir="application" title="Configure default JVM settings">
            <sourcefile file="build.gradle" snippet="application-defaultjvmargs"/>
        </sample>

    </section>

    <section>
        <title>Tasks</title>
        <para>The Application plugin adds the following tasks to the project.</para>
        <table>
            <title>Application plugin - tasks</title>
            <thead>
                <tr>
                    <td>Task name</td>
                    <td>Depends on</td>
                    <td>Type</td>
                    <td>Description</td>
                </tr>
            </thead>
            <tr>
                <td>
                    <literal>run</literal><commit_msg>tweak application plugin userguide chapter<commit_after><!--
  ~ Copyright 2011 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='application_plugin'>
    <title>The Application Plugin</title>
    <para>The Gradle application plugin extends the language plugins with common application related tasks.
    It allows running and bundling applications for the jvm by creating a jvm application <apilink class="org.gradle.api.distribution.Distribution" />.
    </para>

    <section>
        <title>Usage</title>
        <para>To use the application plugin, include the following in your build script:</para>
        <sample id="useApplicationPlugin" dir="application" title="Using the application plugin">
            <sourcefile file="build.gradle" snippet="use-plugin"/>
        </sample>
        <para>To define the main-class for the application you have to set the <literal>mainClassName</literal> property as shown below</para>
        <sample id="useApplicationPlugin" dir="application" title="Configure the application main class">
            <sourcefile file="build.gradle" snippet="mainClassName-conf"/>
        </sample>

        <para>Then, you can run the application by running <userinput>gradle run</userinput>. Gradle will take care of building the application classes,
            along with their runtime dependencies, and starting the application with the correct classpath.
            You can launch the application in debug mode with <userinput>gradle run --debug-jvm</userinput> (see <apilink class="org.gradle.api.tasks.JavaExec" method="setDebug(boolean)" />).
        </para>

        <para>The plugin can also build a distribution for your application. The <apilink class="org.gradle.api.distribution.Distribution" /> will package up the runtime dependencies of the application
            along with some OS specific start scripts. All files stored in <filename>src/dist</filename> will be added to the root of the
            distribution. You can run <userinput>gradle installDist</userinput> to create an image of the application in
            <filename>build/install/<replaceable>projectName</replaceable></filename>. You can run <userinput>gradle distZip</userinput> to create a
            ZIP containing the distribution, <userinput>gradle distTar</userinput> to create an application TAR or <userinput>gradle assemble</userinput> to build both.
        </para>

        <para>
            If your Java application requires a specific set of JVM settings or system properties, you can configure the <literal>applicationDefaultJvmArgs</literal> property.
            These JVM arguments are applied to the <literal>run</literal> task and also considered in the generated start scripts of your distribution.
        </para>
        <sample id="configureApplicationDefaultJvmArgs" dir="application" title="Configure default JVM settings">
            <sourcefile file="build.gradle" snippet="application-defaultjvmargs"/>
        </sample>

    </section>

    <section>
        <title>Tasks</title>
        <para>The Application plugin adds the following tasks to the project.</para>
        <table>
            <title>Application plugin - tasks</title>
            <thead>
                <tr>
                    <td>Task name</td>
                    <td>Depends on</td>
                    <td>Type</td>
                    <td>Description</td>
                </tr>
            </thead>
            <tr>
                <td>
                    <literal>run</literal>
{'fraction_non_alphanumeric': 0.08725744654554443, 'fraction_numerical': 0.001977505870720554, 'mean_word_length': 2.879194630872483, 'pattern_counts': {'":': 0, '<': 161, '<?xml version=': 0, '>': 161, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3399389', 'n_tokens_mistral': 2001, 'n_tokens_neox': 1914, 'n_words': 781}