Package org.gradle.api.plugins

## Class JavaPlugin

- java.lang.Object
- - org.gradle.api.plugins.JavaPlugin

- All Implemented Interfaces:
    `Plugin<Project>`

      public class JavaPlugin
      extends java.lang.Object
      implements Plugin<Project>

  A `Plugin` which compiles and tests Java source, and assembles it into a JAR file.

  This plugin creates a built-in `test suite` named `test` that represents the `Test` task for Java projects.
  See Also:
    Java plugin reference, JVM test suite plugin reference

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `ANNOTATION_PROCESSOR_CONFIGURATION_NAME` | The name of the annotation processor configuration.
    `static java.lang.String` | `API_CONFIGURATION_NAME` | The name of the API configuration, where dependencies exported by a component at compile time should be declared.
    `static java.lang.String` | `API_ELEMENTS_CONFIGURATION_NAME` | The name of the configuration to define the API elements of a component.
    `static java.lang.String` | `CLASSES_TASK_NAME` | The name of the lifecycle task which outcome is that all the classes of a component are generated.
    `static java.lang.String` | `COMPILE_CLASSPATH_CONFIGURATION_NAME` | The name of the compile classpath configuration.
    `static java.lang.String` | `COMPILE_JAVA_TASK_NAME` | The name of the task which compiles Java sources.
    `static java.lang.String` | `COMPILE_ONLY_API_CONFIGURATION_NAME` | The name of the configuration to define the API elements of a component that are required to compile a component, but not at runtime.
    `static java.lang.String` | `COMPILE_ONLY_CONFIGURATION_NAME` | The name of the configuration that is used to declare dependencies which are only required to compile a component, but not at runtime.
    `static java.lang.String` | `COMPILE_TEST_JAVA_TASK_NAME` | The name of the task which compiles the test Java sources.
    `static java.lang.String` | `IMPLEMENTATION_CONFIGURATION_NAME` | The name of the implementation configuration, where dependencies that are only used internally by a component should be declared.
    `static java.lang.String` | `JAR_TASK_NAME` | The name of the task which generates the component main jar.
    `static java.lang.String` | `JAVADOC_ELEMENTS_CONFIGURATION_NAME` | The name of the javadoc elements configuration.
    `static java.lang.String` | `JAVADOC_TASK_NAME` | The name of the task which generates the component javadoc.
    `static java.lang.String` | `PROCESS_RESOURCES_TASK_NAME` | The name of the task that processes resources.
    `static java.lang.String` | `PROCESS_TEST_RESOURCES_TASK_NAME` | The name of the task which processes the test resources.
    `static java.lang.String` | `RUNTIME_CLASSPATH_CONFIGURATION_NAME` | The name of the runtime classpath configuration, used by a component to query its own runtime classpath.
    `static java.lang.String` | `RUNTIME_ELEMENTS_CONFIGURATION_NAME` | The name of the runtime elements configuration, that should be used by consumers to query the runtime dependencies of a component.
    `static java.lang.String` | `RUNTIME_ONLY_CONFIGURATION_NAME` | The name of the runtime only dependencies configuration, used to declare dependencies that should only be found at runtime.
    `static java.lang.String` | `SOURCES_ELEMENTS_CONFIGURATION_NAME` | The name of the sources elements configuration.
    `static java.lang.String` | `TEST_ANNOTATION_PROCESSOR_CONFIGURATION_NAME` | The name of the test annotation processor configuration.
    `static java.lang.String` | `TEST_CLASSES_TASK_NAME` | The name of the lifecycle task which outcome is that all test classes of a component are generated.
    `static java.lang.String` | `TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME` | The name of the test compile classpath configuration.
    `static java.lang.String` | `TEST_COMPILE_ONLY_CONFIGURATION_NAME` | The name of the configuration that should be used to declare dependencies which are only required to compile the tests, but not when running them.
    `static java.lang.String` | `TEST_IMPLEMENTATION_CONFIGURATION_NAME` | The name of the test implementation dependencies configuration.
    `static java.lang.String` | `TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME` | The name of the test runtime classpath configuration.
    `static java.lang.String` | `TEST_RUNTIME_ONLY_CONFIGURATION_NAME` | The name of the test runtime only dependencies configuration.
    `static java.lang.String` | `TEST_TASK_NAME` | The name of the task which triggers execution of tests.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JavaPlugin​(ObjectFactory objectFactory, SoftwareComponentFactory softwareComponentFactory, org.gradle.api.plugins.jvm.internal.JvmPluginServices jvmServices)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `apply​(Project project)` | Apply this plugin to the given target object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROCESS_RESOURCES_TASK_NAME

          public static final java.lang.String PROCESS_RESOURCES_TASK_NAME

      The name of the task that processes resources.
      See Also:
        Constant Field Values

    - #### CLASSES_TASK_NAME

          public static final java.lang.String CLASSES_TASK_NAME

      The name of the lifecycle task which outcome is that all the classes of a component are generated.
      See Also:
        Constant Field Values

    - #### COMPILE_JAVA_TASK_NAME

          public static final java.lang.String COMPILE_JAVA_TASK_NAME

      The name of the task which compiles Java sources.
      See Also:
        Constant Field Values

    - #### PROCESS_TEST_RESOURCES_TASK_NAME

          public static final java.lang.String PROCESS_TEST_RESOURCES_TASK_NAME

      The name of the task which processes the test resources.
      See Also:
        Constant Field Values

    - #### TEST_CLASSES_TASK_NAME

          public static final java.lang.String TEST_CLASSES_TASK_NAME

      The name of the lifecycle task which outcome is that all test classes of a component are generated.
      See Also:
        Constant Field Values

    - #### COMPILE_TEST_JAVA_TASK_NAME

          public static final java.lang.String COMPILE_TEST_JAVA_TASK_NAME

      The name of the task which compiles the test Java sources.
      See Also:
        Constant Field Values

    - #### TEST_TASK_NAME

          public static final java.lang.String TEST_TASK_NAME

      The name of the task which triggers execution of tests.
      See Also:
        Constant Field Values

    - #### JAR_TASK_NAME

          public static final java.lang.String JAR_TASK_NAME

      The name of the task which generates the component main jar.
      See Also:
        Constant Field Values

    - #### JAVADOC_TASK_NAME

          public static final java.lang.String JAVADOC_TASK_NAME

      The name of the task which generates the component javadoc.
      See Also:
        Constant Field Values

    - #### API_CONFIGURATION_NAME

          public static final java.lang.String API_CONFIGURATION_NAME

      The name of the API configuration, where dependencies exported by a component at compile time should be declared.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### IMPLEMENTATION_CONFIGURATION_NAME

          public static final java.lang.String IMPLEMENTATION_CONFIGURATION_NAME

      The name of the implementation configuration, where dependencies that are only used internally by a component should be declared.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### API_ELEMENTS_CONFIGURATION_NAME

          public static final java.lang.String API_ELEMENTS_CONFIGURATION_NAME

      The name of the configuration to define the API elements of a component. That is, the dependencies which are required to compile against that component.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### COMPILE_ONLY_CONFIGURATION_NAME

          public static final java.lang.String COMPILE_ONLY_CONFIGURATION_NAME

      The name of the configuration that is used to declare dependencies which are only required to compile a component, but not at runtime.
      See Also:
        Constant Field Values

    - #### COMPILE_ONLY_API_CONFIGURATION_NAME

          public static final java.lang.String COMPILE_ONLY_API_CONFIGURATION_NAME

      The name of the configuration to define the API elements of a component that are required to compile a component, but not at runtime.
      Since:
        6.7
      See Also:
        Constant Field Values

    - #### RUNTIME_ONLY_CONFIGURATION_NAME

          public static final java.lang.String RUNTIME_ONLY_CONFIGURATION_NAME

      The name of the runtime only dependencies configuration, used to declare dependencies that should only be found at runtime.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### RUNTIME_CLASSPATH_CONFIGURATION_NAME

          public static final java.lang.String RUNTIME_CLASSPATH_CONFIGURATION_NAME

      The name of the runtime classpath configuration, used by a component to query its own runtime classpath.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### RUNTIME_ELEMENTS_CONFIGURATION_NAME

          public static final java.lang.String RUNTIME_ELEMENTS_CONFIGURATION_NAME

      The name of the runtime elements configuration, that should be used by consumers to query the runtime dependencies of a component.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### JAVADOC_ELEMENTS_CONFIGURATION_NAME

          public static final java.lang.String JAVADOC_ELEMENTS_CONFIGURATION_NAME

      The name of the javadoc elements configuration.
      Since:
        6.0
      See Also:
        Constant Field Values

    - #### SOURCES_ELEMENTS_CONFIGURATION_NAME

          public static final java.lang.String SOURCES_ELEMENTS_CONFIGURATION_NAME

      The name of the sources elements configuration.
      Since:
        6.0
      See Also:
        Constant Field Values

    - #### COMPILE_CLASSPATH_CONFIGURATION_NAME

          public static final java.lang.String COMPILE_CLASSPATH_CONFIGURATION_NAME

      The name of the compile classpath configuration.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### ANNOTATION_PROCESSOR_CONFIGURATION_NAME

          public static final java.lang.String ANNOTATION_PROCESSOR_CONFIGURATION_NAME

      The name of the annotation processor configuration.
      Since:
        4.6
      See Also:
        Constant Field Values

    - #### TEST_IMPLEMENTATION_CONFIGURATION_NAME

          public static final java.lang.String TEST_IMPLEMENTATION_CONFIGURATION_NAME

      The name of the test implementation dependencies configuration.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### TEST_COMPILE_ONLY_CONFIGURATION_NAME

          public static final java.lang.String TEST_COMPILE_ONLY_CONFIGURATION_NAME

      The name of the configuration that should be used to declare dependencies which are only required to compile the tests, but not when running them.
      See Also:
        Constant Field Values

    - #### TEST_RUNTIME_ONLY_CONFIGURATION_NAME

          public static final java.lang.String TEST_RUNTIME_ONLY_CONFIGURATION_NAME

      The name of the test runtime only dependencies configuration.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME

          public static final java.lang.String TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME

      The name of the test compile classpath configuration.
      Since:
        3.4
      See Also:
        Constant Field Values

    - #### TEST_ANNOTATION_PROCESSOR_CONFIGURATION_NAME

          public static final java.lang.String TEST_ANNOTATION_PROCESSOR_CONFIGURATION_NAME

      The name of the test annotation processor configuration.
      Since:
        4.6
      See Also:
        Constant Field Values

    - #### TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME

          public static final java.lang.String TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME

      The name of the test runtime classpath configuration.
      Since:
        3.4
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JavaPlugin

          @Inject
          public JavaPlugin​(ObjectFactory objectFactory,
                            SoftwareComponentFactory softwareComponentFactory,
                            org.gradle.api.plugins.jvm.internal.JvmPluginServices jvmServices)

  - ### Method Detail

    - #### apply

          public void apply​(Project project)

      Description copied from interface: `Plugin`
      Apply this plugin to the given target object.
      Specified by:
        `apply` in interface `Plugin<Project>`
      Parameters:
        `project` - The target object