# `gradle_java_compile`

Compile Java sources directly into a deterministic classes-only archive. Native [`gradle_workspace`](/reference/prelude/gradle_workspace) discovery emits this target with supported Gradle compiler options and only its compile classpath dependency.

```toml
[[target]]
name = "compileJava"
kind = "gradle_java_compile"
srcs = ["src/main/java/**/*.java"]
```

`java_home` defaults to `JAVA_HOME` or the resolved `javac`. `compiler_args` accepts explicit compiler options; native discovery supplies source/target compatibility or `--release`, encoding, debug and warning settings and disables annotation processing. The compiler identity and all source and classpath files participate in action caching. It does not resolve or require Kotlin.

The `gradle_compilation` provider exposes `classes_jar`, `transitive_compile_jars` and `affected_inputs`. It deliberately does not advertise a runtime or Java-library provider: a compile classpath is not a runtime classpath. Gradle resources, configured archive packaging and test execution are outside this contract.
