Building an application¶
Contents
Before You Start¶
Maven Central Repository¶
You can pull the jar file of the Doma framework from the Maven central repository. The group id and artifact id are as follows:
GroupId: | org.seasar.doma |
---|---|
ArtifactId: | doma |
See also: https://search.maven.org/artifact/org.seasar.doma/doma/
Build with Eclipse¶
Note
Instead of manual settings we show you below, we recommend to generate eclipse setting files automatically with the Gradle Eclipse Plugin. See also build.gradle and eclipse.gradle in the domaframework/simple-boilerplate repository.
Enabling annotation processing¶
- Select “Project > Properties” from the menu bar and open the dialog
- Select “Java Compiler > Annotation Processing” from the left menu of the dialog
- Check as follows:
Setting factory path¶
- Select “Project > Properties” from the menu bar and open the dialog
- Select “Java Compiler > Annotation Processing > Factory Path” from the left menu of the dialog
- Add the jar file of the Doma framework whose version is same as the one in the Java Build Path
- Check as follows:
Build with Gradle¶
build.gradle as an example:
apply plugin: 'java'
// Copy the resources referred by the Doma annotation processors to
// the destinationDir of the compileJava task
task copyDomaResources(type: Sync) {
from sourceSets.main.resources.srcDirs
into compileJava.destinationDir
include 'doma.compile.config'
include 'META-INF/**/*.sql'
include 'META-INF/**/*.script'
}
compileJava {
// Depend on the above task
dependsOn copyDomaResources
options.encoding = 'UTF-8'
}
compileTestJava {
options.encoding = 'UTF-8'
// Disable the annotation processors during the test run
options.compilerArgs = ['-proc:none']
}
dependencies {
annotationProcessor "org.seasar.doma:doma:2.22.0"
implementation "org.seasar.doma:doma:2.22.0"
}
repositories {
mavenCentral()
maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'}
}
Note
The description maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'}
is required
only when you need the SNAPSHOT version of the Doma framework.
Note
With the above build.gradle, you will benefits from Incremental annotation processing.
See also build.gradle in the domaframework/simple-boilerplate repository.