Page history Edit this page How do I edit this website?
Original MediaWiki page

Kotlin

The content of this page has not been vetted since shifting away from MediaWiki. If you’d like to help, check out the how to help guide!

In order to start using Kotlin to develop plugins we need to ensure that the Annotation are pre processed so that ImageJ can display the shortcuts in the menu’s

To accomplish that the following code need to be added to your pom:

<execution>
    <id>kapt</id>
    <goals>
        <goal>kapt</goal>
    </goals>
    <configuration>
        <sourceDirs>
            <sourceDir>src/main/kotlin</sourceDir>
            <sourceDir>src/main/java</sourceDir>
            </sourceDirs>
        <annotationProcessorPaths>
            <annotationProcessorPath>
                <groupId>net.imagej</groupId>
                <artifactId>imagej</artifactId>
                <version>2.0.0-rc-68</version>
            </annotationProcessorPath>
        </annotationProcessorPaths>
    </configuration>
</execution>

and example can also be found in https://github.com/imagej/example-imagej-command-kotlin/pom.xml

If gradle is your built system of choice, then the following code need to be added to your build.gradle:

plugins {
   id "org.jetbrains.kotlin.kapt" version "1.3.10"
}

dependencies {
   kapt 'net.imagej:imagej:2.0.0-rc-68'
}

and example can also be found in https://github.com/imagej/example-imagej-command-kotlin/build.gradle