[[build-integrations]]
= Build system &amp; framework integrations

This kind of integration for Geb is typically focused on managing the base URL and reports dir, as build systems tend to be able to provide this configuration (via the
<<build-adapter-config, build adapter>> mechanism).

== Gradle

Using Geb with Gradle simply involves pulling in the appropriate dependencies, and configuring the base URL and reports dir in the build script if they are necessary.

Below is a valid Gradle `build.gradle` file for working with Geb for testing.

[tabs]
====
Kotlin::
+
[source,kotlin,subs="+attributes"]
----
plugins {
    groovy
}

repositories {
    mavenCentral()
}

val gebVersion = "{geb-version}"
val seleniumVersion = "{selenium-version}"

dependencies {
    testImplementation("org.spockframework:spock-core:{spock-core-version}")

    // If using Spock, need to depend on geb-spock
    testImplementation("{geb-group}:geb-spock:$gebVersion")

    // If using JUnit, need to depend on geb-junit (4 or 5)
    //testImplementation("{geb-group}:geb-junit5:$gebVersion")

    // Need a driver implementation
    testRuntimeOnly("org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion")
}

tasks.test {
    useJUnitPlatform()
    systemProperty("geb.build.baseUrl", "https://google.com")
}
----

Groovy::
+
[source,groovy,subs="+attributes"]
----
plugins {
    id "groovy"
}

repositories {
    mavenCentral()
}

def gebVersion = "{geb-version}"
def seleniumVersion = "{selenium-version}"

dependencies {
    testImplementation "org.spockframework:spock-core:{spock-core-version}"

    // If using Spock, need to depend on geb-spock
    testImplementation "{geb-group}:geb-spock:$gebVersion"

    // If using JUnit, need to depend on geb-junit (4 or 5)
    //testImplementation "{geb-group}:geb-junit5:$gebVersion"

    // Need a driver implementation
    testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
}

tasks.test {
    useJUnitPlatform()
    systemProperty("geb.build.baseUrl", "https://google.com")
}
----
====

There is a Gradle example project available.

* link:https://github.com/geb/geb-example-gradle[geb-example-gradle]

== Maven

Using Geb with Maven simply involves pulling in the appropriate dependencies, and configuring the base URL and reports dir in the build script if they are necessary.

Below is a valid `pom.xml` file for working with Geb for testing (with Spock).

[source,xml,subs="+attributes"]
----
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="
             http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd
         ">
    <modelVersion>4.0.0</modelVersion>
    <groupId>{geb-group}.example</groupId>
    <artifactId>geb-maven-example</artifactId>
    <packaging>jar</packaging>
    <version>1</version>
    <name>Geb Maven Example</name>
    <url>https://groovy.apache.org/geb/</url>
    <dependencies>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>{spock-core-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>{geb-group}</groupId>
            <artifactId>geb-spock</artifactId>
            <version>{geb-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>{selenium-version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.3</version>
                <configuration>
                    <includes>
                        <include>*Spec.*</include>
                    </includes>
                    <systemPropertyVariables>
                        <geb.build.baseUrl>https://google.com</geb.build.baseUrl>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>4.1.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compileTests</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
----

There is a Maven example project available.

* link:https://github.com/geb/geb-example-maven[geb-example-maven]
