# Build tool integration

> Use Elide's javac, kotlinc, dependency resolver and JDK from inside an existing Maven, Gradle or Bazel build, without migrating to elide.pkl.

Keep your build tool and use Elide where it runs: as the Java and Kotlin compiler, the dependency resolver, or the JDK.

| Build tool | Integration | Elide compiles | Page |
| --- | --- | --- | --- |
| Maven | `dev.elide:elide-maven-plugin` | Java, Kotlin | [Maven plugin](https://elide.help/docs/build-tools-maven) |
| Gradle | `dev.elide.settings` + `dev.elide` plugins | Java | [Gradle plugin](https://elide.help/docs/build-tools-gradle) |
| Bazel | `rules_elide` module, persistent workers | Java, Kotlin | [Bazel](https://elide.help/docs/build-tools-bazel) |
| Any | `elide project export --format=pom`, `elide mvn` | Java, Kotlin | [POM export and native Maven](https://elide.help/docs/build-tools-export) |
| Any | `JAVA_HOME` set to the Elide distribution | Java | [Build the POM](https://elide.help/docs/build-tools-export#build-the-pom) |

## Integrate or migrate

| | Integrate (this section) | Migrate ([`elide adopt`](https://elide.help/docs/toolchain/usage/adopt)) |
| --- | --- | --- |
| Build definition | Stays `pom.xml`, `build.gradle.kts` or `BUILD.bazel` | Becomes `elide.pkl` |
| Build commands | `mvn`, `./gradlew`, `bazel` | `elide build`, `elide test` |
| What Elide replaces | The compiler, resolver or JDK | The whole build |
| Undo | Remove the plugin or rule | Keep the old build until the new one passes |

## Call the tools directly

Every Elide tool takes the wrapped tool's arguments after `--`, so any build that can run a command can use it:

```bash
elide javac -- -d out -cp lib/guava.jar src/Hello.java
elide kotlinc -- -d out src/Greeter.kt
elide jar -- --create --file app.jar -C out .
```

Per-tool options: [Java compiler](https://elide.help/docs/toolchain/jvm/javac), [Kotlin compiler](https://elide.help/docs/toolchain/jvm/kotlinc),
[JAR assembly](https://elide.help/docs/toolchain/jvm/jar).

## OpenRewrite and dependency queries

Elide also provides experimental [OpenRewrite](https://elide.help/docs/toolchain/jvm/rewrite) and
[dependency code index](https://elide.help/docs/toolchain/jvm/code-index) commands. They read an `elide.pkl` project definition, including
its source sets and Maven dependencies. Compiler integration alone does not connect a Maven, Gradle, or Bazel
dependency graph to those commands.

To use them alongside an existing build, define matching sources, target version, repositories, and dependencies
in `elide.pkl`, or [adopt the project](https://elide.help/docs/toolchain/usage/adopt). Run recipe previews with `elide rewrite ... --dry-run`,
then validate any applied changes with the build's usual tests.

## Publish for Maven and Gradle consumers

A library built with Elide publishes to the local Maven repository, a team repository or Maven Central with
`elide publish`, so Maven and Gradle builds depend on it like any other artifact. See
[Maven publishing](https://elide.help/docs/toolchain/jvm/publishing).
