Skip to content

PowerShell mill.bat: -Dkey=value with unquoted dotted value fails with misleading file-lock error #7061

@odenix

Description

@odenix

On Windows PowerShell, invoking mill.bat with -Dkey=0.1.0 fails with a misleading file-lock error during build script resolution.

Minimal build.mill:

import mill.*

object `package` extends RootModule {
  def printProperty() = Task.Command {
    println(System.getProperty("RELEASE_VERSION"))
  }
}

Failing command:

.\mill.bat -DRELEASE_VERSION=0.1.0 printProperty

Actual behavior:

Mill appears to receive .1.0 printProperty rather than the intended system property argument, then fails with:

java.io.IOException: The process cannot access the file because another process has locked a portion of the file
    at mill.api.PathRef$.apply(PathRef.scala:132)
    at mill.api.BuildCtx$.evalWatch(BuildCtx.scala:69)
    at mill.eval.ScriptModuleInit.resolveScriptModule(ScriptModuleInit.scala:197)

Expected behavior:

Either accept -Dkey=0.1.0, or reject it with a clear argument parsing error. It should not fail with a file-lock error.

These forms work in Powershell:

.\mill.bat -DRELEASE_VERSION="0.1.0" printProperty
.\mill.bat -D RELEASE_VERSION=0.1.0 printProperty
.\mill.bat --define RELEASE_VERSION=0.1.0 printProperty

In cmd.exe, this form also works:

mill.bat -DRELEASE_VERSION=0.1.0 printProperty

Environment:

Mill Build Tool version 1.1.5-44-d4c442
java.version: 21.0.10
java.vendor: Eclipse Adoptium
file.encoding: UTF-8
os.name: Windows 11
os.version: 10.0
os.arch: amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions