Building an application

Maven Central Repository

You can obtain the Doma framework artifacts from the Maven central repository. We provide two artifacts: doma-core and doma-processor.

The doma-core artifact is required at both runtime and compile-time. The doma-processor artifact, which provides annotation processors, is required only at compile-time.

The group id and artifact id of those artifacts are as follows:

GroupId:

org.seasar.doma

ArtifactId:

doma-core

GroupId:

org.seasar.doma

ArtifactId:

doma-processor

Build with Gradle

Write your build.gradle(.kts) as follows:

plugins {
    id("org.domaframework.doma.compile") version "4.0.2"
}

dependencies {
    implementation("org.seasar.doma:doma-core:3.10.0")
    annotationProcessor("org.seasar.doma:doma-processor:3.10.0")
}

We recommend using the org.domaframework.doma.compile plugin to simplify your build script.

See build.gradle.kts in the getting-started repository as an example.

Build with Maven

Write your pom.xml as follows:

...
<properties>
    <doma.version>3.10.0</doma.version>
</properties>
...
<dependencies>
    <dependency>
        <groupId>org.seasar.doma</groupId>
        <artifactId>doma-core</artifactId>
        <version>${doma.version}</version>
    </dependency>
</dependencies>
...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>17</source> <!-- depending on your project -->
                <target>17</target> <!-- depending on your project -->
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.seasar.doma</groupId>
                        <artifactId>doma-processor</artifactId>
                        <version>${doma.version}</version>
                    </path>
                </annotationProcessorPaths>
                <compilerArgs>
                    <!-- if you are using a Maven project in Eclipse, this argument is required -->
                    <arg>-Adoma.resources.dir=${project.basedir}/src/main/resources</arg>
                </compilerArgs>
            </configuration>
        </plugin>
    </plugins>
</build>

Build with Eclipse

Gradle

Import your project as a Gradle project. To reflect Gradle settings in Eclipse, right-click on your project and select Gradle > Refresh Gradle Project.

See build.gradle.kts in the getting-started repository as an example.

Maven

Import your project as a Maven project.

Right-click on the project and select Properties > Maven > Annotation Processing. Enable both “Enable Project specific settings” and “Automatically configure JDT APT” as shown below.

Eclipse Maven Annotation Processing

To refresh Maven settings in Eclipse, right-click on your project and select Maven > Update Project…

Note

You must add the following argument to the Maven compiler plugin configuration in your pom.xml:

<compilerArgs>
    <arg>-Adoma.resources.dir=${project.basedir}/src/main/resources</arg>
</compilerArgs>

Build with IntelliJ IDEA

Gradle

Import your project as a Gradle project. Build and run using Gradle.

Maven

Import your project as a Maven project. Build and run using Maven.