# Maven

## Configuring the Maven build tool

You can use Deeplearning4j with Maven by adding the following to your `pom.xml`:

```markup
<dependencies>
  <dependency>
      <groupId>org.deeplearning4j</groupId>
      <artifactId>deeplearning4j-core</artifactId>
      <version>1.0.0-M2.1</version>
  </dependency>
</dependencies>
```

The instructions below apply to all DL4J and ND4J submodules, such as `deeplearning4j-api`, `deeplearning4j-scaleout`, and ND4J backends.

## Add a backend

DL4J relies on ND4J for hardware-specific implementations and tensor operations. Add a backend by pasting the following snippet into your `pom.xml`:

```markup
<dependencies>
  <dependency>
      <groupId>org.nd4j</groupId>
      <artifactId>nd4j-native-platform</artifactId>
      <version>1.0.0-M2.1</version>
  </dependency>
</dependencies>
```

You can also swap the standard CPU implementation for [GPUs](https://deeplearning4j.konduit.ai/multi-project/configuration/backends/cudnn#cudnn-setup). Note that for mac m1 systems, you must use the following configuration, this is normally not needed but mac m1 does not have dependencies for everything.<br>

```
<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native</artifactId>
  <version>1.0.0-M2.1</version>
</dependency>
<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native</artifactId>
  <version>1.0.0-M2.1</version>
  <classifier>macosx-arm64</classifier>
</dependency>
<dependency>
  <groupId>org.bytedeco</groupId>
  <artifactId>openblas</artifactId>
  <version>0.3.21-1.5.8</version>
  <classifier>macosx-arm64</classifier>
</dependency>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deeplearning4j.konduit.ai/multi-project/explanation/maven.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
