Error when trying to create a module using Gradle

Hi ,

I am trying to create a module using Gradle following the steps here Create a Module | Ignition SDK Programmer's Guide

Did following steps . I am using gradle-8.1.1 and tired with both Java 22 and Java 17

  1. git clone GitHub - inductiveautomation/ignition-module-tools: Tools that help in the creation and development of Modules for Inductive Automation's Ignition.

  2. Opened the directory containing ignition-module-tools.Navigated one level down into generator. Opened a command prompt in this directory and run the following: gradlew.bat clean build

Getting below error:

C:\my\Code\official\Igntion\Modules\ignition-module-tools-master\generator>gradlew.bat clean build
Type-safe project accessors is an incubating feature.
> Task :generator-cli:spotlessKotlinCheck FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generator-cli:spotlessKotlinCheck'.
> The following files had format violations:
      src\main\kotlin\io\ia\sdk\tools\module\cli\ModuleGeneratorCli.kt
          @@ -1,189 +1,189 @@
          -/*\n
          - * This Kotlin source file was generated by the Gradle 'init' task.\n
          - */\n
          -package io.ia.sdk.tools.module.cli\n
          -\n
          -import io.ia.ignition.module.generator.ModuleGenerator\n
          -import io.ia.ignition.module.generator.api.GeneratorConfigBuilder\n
          -import io.ia.ignition.module.generator.api.GradleDsl\n
          -import org.slf4j.Logger\n
          -import org.slf4j.LoggerFactory\n
          -import picocli.CommandLine\n
          -import picocli.CommandLine.Command\n
          -import picocli.CommandLine.HelpCommand\n
          -import picocli.CommandLine.Option\n
          -import java.io.File\n
          -import java.time.Duration\n
          -import java.time.Instant\n
          -import java.util.concurrent.Callable\n
          -\n
          -@Command(\n
          -    name = "ignition-module-gen",\n
          -    version = ["0.4.0"],\n
          -    description = ["Generates an Ignition module skeleton according to provided arguments."],\n
          -    subcommands = [HelpCommand::class],\n
          -    mixinStandardHelpOptions = true\n
          -)\n
          -class ModuleGeneratorCli : Callable<Int> {\n
          -\n
          -    /**\n
          -     *\n
          -     */\n
          -    @Option(names = ["-s", "--scope"], description = ["Shorthand scope String like 'DCG'"])\n
          -    var scope: String? = null\n
          -\n
          -    /**\n
          -     *\n
          -     */\n
          -    @Option(\n
          -        names = ["-d", "--directory"],\n
          -        description = ["Absolute path to directory where new project should be created. Default's to cli working dir."]\n
          -    )\n
          -    var directory: String? = File("").absolutePath\n
          -\n
          -    /**\n
          -     *\n
          -     */\n
          -    @Option(\n
          -        names = ["-n", "--name"],\n
      ... (330 more lines that didn't fit)
  Violations also present in:
      src\test\kotlin\io\ia\sdk\tools\module\cli\ModuleGeneratorCliTest.kt
  Run 'gradlew.bat :generator-cli:spotlessApply' to fix these violations.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
10 actionable tasks: 9 executed, 1 up-to-date

Hello,

I tried the same thing and had no problems...

I believe that the problem might be because of the line endings. Do you have your git configured correctly? So it checks out the code with OS line endings vs what is checked in?

Linux uses just LF as the line ending which is showing up as the "\n" in your logs, whereas Windows uses CRLF. I've seen this issue with compilers on Windows having issues compiling code with Linux line endings.

Just my best guess.

Bill S.