Skip to content
Tamás Ádám edited this page Oct 2, 2021 · 5 revisions

Setup

Please replace the ${version} placeholder to the latest version. You can find it by clicking here.

Gradle

Repository

maven { url 'https://repo.danifoldi.com/repository/maven-releases/' }

Dependency

implementation 'grapefruit:grapefruit:${version}'

Parameter names (See note)

compileJava {
    options.compilerArgs << '-parameters'
    options.fork = true
    options.forkOptions.executable = 'javac'
}

Maven

Repository

<repository>
    <id>danifoldi-releases</id>
    <url>https://repo.danifoldi.com/repository/maven-releases/</url>
</repository>

Dependency

<dependency>
    <groupId>grapefruit</groupId>
    <artifactId>grapefruit</artifactId>
    <version>${version}</version>
</dependency>

Parameter names (See note)

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <compilerArgs>
                    <arg>-parameters</arg>
                </compilerArgs>
            </configuration>
        </plugin>
    </plugins>
</build>

A note about parameter names

Grapefruit relies on parameter names to generate syntax for commands on the fly. However, by default parameters are renamed to arg0, arg1, argN... Luckily there is a workaround, which makes sure that parameter names remain untouched during compilation. If you decide to skip this step the framework will still function properly, but the generated syntax messages will end up looking something like this: root <arg0> <arg1> [arg2]