RunModule

mill.scalalib.RunModule
See theRunModule companion object

Attributes

Companion
object
Source
RunModule.scala
Graph
Supertypes
trait RunModuleApi
trait Module
trait ModuleApi
trait Wrapper
class BaseClass
trait Cacher
trait Cacher
class Object
trait Matchable
class Any
Show all
Known subtypes
trait JavaModule
trait JavaTests
trait KotlinTests
trait KspTests
trait KotestTests
trait MavenTests
trait SbtTests
trait ScalaTests
trait ScalaJSTests
trait KtfmtModule
object KtfmtModule
trait KotlinModule
trait DetektModule
trait KoverModule
trait KspModule
trait BomModule
trait JlinkModule
trait MavenModule
trait SbtModule
trait ScalaModule
trait UnidocModule
trait TestModule
trait AndroidJUnit
trait Junit4
trait Junit5
trait Munit
trait ScalaCheck
trait ScalaTest
trait Specs2
trait TestNg
trait Utest
trait Weaver
trait ZioTest
Show all

Members list

Type members

Inherited classlikes

@Scaladoc(value = "/**\n * Miscellaneous machinery around traversing & querying the build hierarchy,\n * that should not be needed by normal users of Mill\n */")
object moduleInternal extends Internal

Miscellaneous machinery around traversing & querying the build hierarchy, that should not be needed by normal users of Mill

Miscellaneous machinery around traversing & querying the build hierarchy, that should not be needed by normal users of Mill

Attributes

Inherited from:
Module
Source
Module.scala
Supertypes
class Internal
class Object
trait Matchable
class Any

Value members

Concrete methods

@Scaladoc(value = "/**\n * Environment variables to pass to the forked JVM.\n *\n * Includes [[forkEnv]] and the variables defined by Mill itself.\n */")
def allForkEnv: Simple[Map[String, String]]

Environment variables to pass to the forked JVM.

Environment variables to pass to the forked JVM.

Includes forkEnv and the variables defined by Mill itself.

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * All main classes detected in this module that can serve as program entry-points.\n */")
def allLocalMainClasses: Simple[Seq[String]]

All main classes detected in this module that can serve as program entry-points.

All main classes detected in this module that can serve as program entry-points.

Attributes

Source
RunModule.scala
def finalMainClass: Simple[String]

Attributes

Source
RunModule.scala
def finalMainClassOpt: Simple[Either[String, String]]

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Any command-line parameters you want to pass to the forked JVM.\n */")
def forkArgs: Simple[Seq[String]]

Any command-line parameters you want to pass to the forked JVM.

Any command-line parameters you want to pass to the forked JVM.

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Any environment variables you want to pass to the forked JVM.\n */")
def forkEnv: Simple[Map[String, String]]

Any environment variables you want to pass to the forked JVM.

Any environment variables you want to pass to the forked JVM.

Attributes

Source
RunModule.scala
def forkWorkingDir: Simple[Path]

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Builds a command-line \"launcher\" file that can be used to run this module\'s\n * code, without the Mill process. Useful for deployment & other places where\n * you do not want a build tool running\n */")

Builds a command-line "launcher" file that can be used to run this module's code, without the Mill process. Useful for deployment & other places where you do not want a build tool running

Builds a command-line "launcher" file that can be used to run this module's code, without the Mill process. Useful for deployment & other places where you do not want a build tool running

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * The elements of the run classpath which are local to this module.\n * This is typically the output of a compilation step and bundles runtime resources.\n */")

The elements of the run classpath which are local to this module. This is typically the output of a compilation step and bundles runtime resources.

The elements of the run classpath which are local to this module. This is typically the output of a compilation step and bundles runtime resources.

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Allows you to specify an explicit main class to use for the `run` command.\n * If none is specified, the classpath is searched for an appropriate main\n * class to use if one exists.\n */")
def mainClass: Simple[Option[String]]

Allows you to specify an explicit main class to use for the run command. If none is specified, the classpath is searched for an appropriate main class to use if one exists.

Allows you to specify an explicit main class to use for the run command. If none is specified, the classpath is searched for an appropriate main class to use if one exists.

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Runs this module\'s code in a subprocess and waits for it to finish\n */")
def run(args: Task[Args]): Command[Unit]

Runs this module's code in a subprocess and waits for it to finish

Runs this module's code in a subprocess and waits for it to finish

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Runs this module\'s code in a background process, until it dies or\n * `runBackground` is used again. This lets you continue using Mill while\n * the process is running in the background: editing files, compiling, and\n * only re-starting the background process when you\'re ready.\n *\n * You can also use `-w foo.runBackground` to make Mill watch for changes\n * and automatically recompile your code & restart the background process\n * when ready. This is useful when working on long-running server processes\n * that would otherwise run forever\n */")
def runBackground(args: Task[Args]): Command[Unit]

Runs this module's code in a background process, until it dies or runBackground is used again. This lets you continue using Mill while the process is running in the background: editing files, compiling, and only re-starting the background process when you're ready.

Runs this module's code in a background process, until it dies or runBackground is used again. This lets you continue using Mill while the process is running in the background: editing files, compiling, and only re-starting the background process when you're ready.

You can also use -w foo.runBackground to make Mill watch for changes and automatically recompile your code & restart the background process when ready. This is useful when working on long-running server processes that would otherwise run forever

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * If true, stdout and stderr of the process executed by `runBackground`\n * or `runMainBackground` is sent to mill\'s stdout/stderr (which usually\n * flow to the console).\n *\n * If false, output will be directed to files `stdout.log` and `stderr.log`\n * in `runBackground.dest` (or `runMainBackground.dest`)\n */")

If true, stdout and stderr of the process executed by runBackground or runMainBackground is sent to mill's stdout/stderr (which usually flow to the console).

If true, stdout and stderr of the process executed by runBackground or runMainBackground is sent to mill's stdout/stderr (which usually flow to the console).

If false, output will be directed to files stdout.log and stderr.log in runBackground.dest (or runMainBackground.dest)

Attributes

Source
RunModule.scala
def runBackgroundTask(mainClass: Task[String], args: Task[Args]): Task[Unit]

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * All classfiles and resources including upstream modules and dependencies\n * necessary to run this module\'s code.\n */")

All classfiles and resources including upstream modules and dependencies necessary to run this module's code.

All classfiles and resources including upstream modules and dependencies necessary to run this module's code.

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Runs this module\'s code in a subprocess and waits for it to finish\n */")
def runForkedTask(mainClass: Task[String], args: Task[Args]): Task[Unit]

Runs this module's code in a subprocess and waits for it to finish

Runs this module's code in a subprocess and waits for it to finish

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Runs this module\'s code in-process within an isolated classloader. This is\n * faster than `run`, but in exchange you have less isolation between runs\n * since the code can dirty the parent Mill process and potentially leave it\n * in a bad state.\n */")
def runLocal(args: Task[Args]): Command[Unit]

Runs this module's code in-process within an isolated classloader. This is faster than run, but in exchange you have less isolation between runs since the code can dirty the parent Mill process and potentially leave it in a bad state.

Runs this module's code in-process within an isolated classloader. This is faster than run, but in exchange you have less isolation between runs since the code can dirty the parent Mill process and potentially leave it in a bad state.

Attributes

Source
RunModule.scala
def runLocalTask(mainClass: Task[String], args: Task[Args]): Task[Unit]

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Same as `run`, but lets you specify a main class to run\n */")
def runMain(mainClass: String, args: String*): Command[Unit]

Same as run, but lets you specify a main class to run

Same as run, but lets you specify a main class to run

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Same as `runBackground`, but lets you specify a main class to run\n */")
def runMainBackground(mainClass: String, args: String*): Command[Unit]

Same as runBackground, but lets you specify a main class to run

Same as runBackground, but lets you specify a main class to run

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Same as `runLocal`, but lets you specify a main class to run\n */")
def runMainLocal(mainClass: String, args: String*): Command[Unit]

Same as runLocal, but lets you specify a main class to run

Same as runLocal, but lets you specify a main class to run

Attributes

Source
RunModule.scala
@Scaladoc(value = "/**\n * Control whether `run*`-targets should use an args file to pass command line args, if possible.\n */")
def runUseArgsFile: Simple[Boolean]

Control whether run*-targets should use an args file to pass command line args, if possible.

Control whether run*-targets should use an args file to pass command line args, if possible.

Attributes

Source
RunModule.scala

Attributes

Source
RunModule.scala

Inherited methods

@Scaladoc(value = "/**\n * The repositories used to resolve dependencies\n *\n * Unlike [[repositoriesTask]], this includes the Mill internal repositories,\n * which allow to resolve Mill internal modules (usually brought in via\n * `JavaModule#coursierDependency`).\n *\n * Beware that this needs to evaluate `JavaModule#coursierProject` of all\n * module dependencies of the current module, which itself evaluates `JavaModule#mvnDeps`\n * and related tasks. You shouldn\'t depend on this task from implementations of `mvnDeps`,\n * which would introduce cycles between Mill tasks.\n */")
def allRepositories: Task[Seq[Repository]]

The repositories used to resolve dependencies

The repositories used to resolve dependencies

Unlike repositoriesTask, this includes the Mill internal repositories, which allow to resolve Mill internal modules (usually brought in via JavaModule#coursierDependency).

Beware that this needs to evaluate JavaModule#coursierProject of all module dependencies of the current module, which itself evaluates JavaModule#mvnDeps and related tasks. You shouldn't depend on this task from implementations of mvnDeps, which would introduce cycles between Mill tasks.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * Bind a dependency ([[Dep]]) to the actual module context (e.g. the scala version and the platform suffix)\n * @return The [[BoundDep]]\n */")

Bind a dependency (Dep) to the actual module context (e.g. the scala version and the platform suffix)

Bind a dependency (Dep) to the actual module context (e.g. the scala version and the platform suffix)

Attributes

Returns

The BoundDep

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * Whether to enable Gradle Module support when fetching dependencies\n */")
def checkGradleModules: Simple[Boolean]

Whether to enable Gradle Module support when fetching dependencies

Whether to enable Gradle Module support when fetching dependencies

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * Customize the coursier file cache.\n *\n * This is rarely needed to be changed, but sometimes e.g. you want to load a coursier plugin.\n * Doing so requires adding to coursier\'s classpath. To do this you could use the following:\n * {{{\n * override def coursierCacheCustomizer = Task.Anon {\n * Some( (fc: coursier.cache.FileCache[Task]) =>\n * fc.withClassLoaders(Seq(classOf[coursier.cache.protocol.S3Handler].getClassLoader))\n * )\n * }\n * }}}\n * @return\n */")
def coursierCacheCustomizer: Task[Option[FileCache[Task] => FileCache[Task]]]

Customize the coursier file cache.

Customize the coursier file cache.

This is rarely needed to be changed, but sometimes e.g. you want to load a coursier plugin. Doing so requires adding to coursier's classpath. To do this you could use the following:

 override def coursierCacheCustomizer = Task.Anon {
    Some( (fc: coursier.cache.FileCache[Task]) =>
      fc.withClassLoaders(Seq(classOf[coursier.cache.protocol.S3Handler].getClassLoader))
    )
 }

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * A `CoursierModule.Resolver` to resolve dependencies.\n *\n * Can be used to resolve external dependencies, if you need to download an external\n * tool from Maven or Ivy repositories, by calling `CoursierModule.Resolver#classpath`.\n *\n * @return `CoursierModule.Resolver` instance\n */")

A CoursierModule.Resolver to resolve dependencies.

A CoursierModule.Resolver to resolve dependencies.

Can be used to resolve external dependencies, if you need to download an external tool from Maven or Ivy repositories, by calling CoursierModule.Resolver#classpath.

Attributes

Returns

CoursierModule.Resolver instance

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * Optional custom Java Home for the JvmWorker to use\n *\n * If this value is None, then the JvmWorker uses the same Java used to run\n * the current mill instance.\n */")
def javaHome: Simple[Option[PathRef]]

Optional custom Java Home for the JvmWorker to use

Optional custom Java Home for the JvmWorker to use

If this value is None, then the JvmWorker uses the same Java used to run the current mill instance.

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala
def jvmId: Simple[String]

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala
def jvmIndexVersion: Simple[String]

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala
@Scaladoc(value = "/**\n * Map dependencies before resolving them.\n * Override this to customize the set of dependencies.\n */")
def mapDependencies: Task[Dependency => Dependency]

Map dependencies before resolving them. Override this to customize the set of dependencies.

Map dependencies before resolving them. Override this to customize the set of dependencies.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * A [[CoursierModule.Resolver]] to resolve dependencies.\n *\n * Unlike [[defaultResolver]], this resolver can resolve Mill modules too\n * (obtained via [[JavaModule.coursierDependency]]).\n *\n * @return `CoursierModule.Resolver` instance\n */")

A CoursierModule.Resolver to resolve dependencies.

A CoursierModule.Resolver to resolve dependencies.

Unlike defaultResolver, this resolver can resolve Mill modules too (obtained via JavaModule.coursierDependency).

Attributes

Returns

CoursierModule.Resolver instance

Inherited from:
CoursierModule
Source
CoursierModule.scala

Attributes

Inherited from:
BaseClass
Source
Module.scala
def moduleDir: Path

Attributes

Inherited from:
Module
Source
Module.scala
def moduleDirJava: Path

Attributes

Inherited from:
Module
Source
Module.scala

Attributes

Inherited from:
Module
Source
Module.scala

Attributes

Inherited from:
Module
Source
Module.scala
@Scaladoc(value = "/**\n * The repositories used to resolve dependencies with [[classpath()]]. This\n * takes Coursier repository strings as input which are defined here:\n *\n * - https://github.com/coursier/coursier/blob/main/docs/pages/reference-repositories.md\n *\n * For example:\n *\n * - https://repo1.maven.org/maven2\n * Maven Central which is the most commonly used Maven repository\n *\n * - file:///Users/alex/test-repo\n * A local repository cache on disk\n *\n * - file://${ivy.home-${user.home}/.ivy2}/local/[defaultPattern]\n * The local Ivy2 repository where Mill, Scala CLI,\n * or sbt publish to when asked to publish locally\n *\n * - file://${user.home}/.m2/repository\n * the local Maven repository. Use of this is not recommended for reasons explained in the link above\n *\n * - https://maven.google.com\n * Google-managed repository that distributes some Android artifacts in particular\n */")
def repositories: Simple[Seq[String]]

The repositories used to resolve dependencies with classpath(). This takes Coursier repository strings as input which are defined here:

The repositories used to resolve dependencies with classpath(). This takes Coursier repository strings as input which are defined here:

For example:

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * A more flexible version of [[repositories]], that allows custom repositories\n * that are not definable by Coursier repository strings. This is a relatively\n * advanced feature, and for most situations overriding [[repositories]] should\n * be sufficient\n *\n * See [[allRepositories]] if you need to resolve Mill internal modules.\n */")
def repositoriesTask: Task[Seq[Repository]]

A more flexible version of repositories, that allows custom repositories that are not definable by Coursier repository strings. This is a relatively advanced feature, and for most situations overriding repositories should be sufficient

A more flexible version of repositories, that allows custom repositories that are not definable by Coursier repository strings. This is a relatively advanced feature, and for most situations overriding repositories should be sufficient

See allRepositories if you need to resolve Mill internal modules.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * Customize the coursier resolution process.\n * This is rarely needed to changed, as the default try to provide a\n * highly reproducible resolution process. But sometime, you need\n * more control, e.g. you want to add some OS or JDK specific resolution properties\n * which are sometimes used by Maven and therefore found in dependency artifact metadata.\n * For example, the JavaFX artifacts are known to use OS specific properties.\n * To fix resolution for JavaFX, you could override this task like the following:\n * {{{\n * override def resolutionCustomizer = Task.Anon {\n * Some( (r: coursier.core.Resolution) =>\n * r.withOsInfo(coursier.core.Activation.Os.fromProperties(sys.props.toMap))\n * )\n * }\n * }}}\n * @return\n */")
def resolutionCustomizer: Task[Option[Resolution => Resolution]]

Customize the coursier resolution process. This is rarely needed to changed, as the default try to provide a highly reproducible resolution process. But sometime, you need more control, e.g. you want to add some OS or JDK specific resolution properties which are sometimes used by Maven and therefore found in dependency artifact metadata. For example, the JavaFX artifacts are known to use OS specific properties. To fix resolution for JavaFX, you could override this task like the following:

Customize the coursier resolution process. This is rarely needed to changed, as the default try to provide a highly reproducible resolution process. But sometime, you need more control, e.g. you want to add some OS or JDK specific resolution properties which are sometimes used by Maven and therefore found in dependency artifact metadata. For example, the JavaFX artifacts are known to use OS specific properties. To fix resolution for JavaFX, you could override this task like the following:

   override def resolutionCustomizer = Task.Anon {
     Some( (r: coursier.core.Resolution) =>
       r.withOsInfo(coursier.core.Activation.Os.fromProperties(sys.props.toMap))
     )
   }

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
@Scaladoc(value = "/**\n * Resolution parameters, allowing to customize resolution internals\n *\n * This rarely needs to be changed. This allows to disable the new way coursier handles\n * BOMs since coursier 2.1.17 (used in Mill since 0.12.3) for example, with:\n * {{{\n * def resolutionParams = super.resolutionParams()\n * .withEnableDependencyOverrides(Some(false))\n * }}}\n *\n * Note that versions forced with `Dep#forceVersion()` take over forced versions manually\n * set in `resolutionParams`. The former should be favored to force versions in dependency\n * resolution.\n *\n * The Scala version set via `ScalaModule#scalaVersion` also takes over any Scala version\n * provided via `ResolutionParams#scalaVersionOpt`.\n *\n * The default configuration set in `ResolutionParams#defaultConfiguration` is ignored when\n * Mill fetches dependencies to be passed to the compiler (equivalent to Maven \"compile scope\").\n * In that case, it forces the default configuration to be \"compile\". On the other hand, when\n * fetching dependencies for runtime (equivalent to Maven \"runtime scope\"), the value in\n * `ResolutionParams#defaultConfiguration` is used.\n */")
def resolutionParams: Task[ResolutionParams]

Resolution parameters, allowing to customize resolution internals

Resolution parameters, allowing to customize resolution internals

This rarely needs to be changed. This allows to disable the new way coursier handles BOMs since coursier 2.1.17 (used in Mill since 0.12.3) for example, with:

 def resolutionParams = super.resolutionParams()
   .withEnableDependencyOverrides(Some(false))

Note that versions forced with Dep#forceVersion() take over forced versions manually set in resolutionParams. The former should be favored to force versions in dependency resolution.

The Scala version set via ScalaModule#scalaVersion also takes over any Scala version provided via ResolutionParams#scalaVersionOpt.

The default configuration set in ResolutionParams#defaultConfiguration is ignored when Mill fetches dependencies to be passed to the compiler (equivalent to Maven "compile scope"). In that case, it forces the default configuration to be "compile". On the other hand, when fetching dependencies for runtime (equivalent to Maven "runtime scope"), the value in ResolutionParams#defaultConfiguration is used.

Attributes

Inherited from:
CoursierModule
Source
CoursierModule.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Module -> Any
Inherited from:
Module
Source
Module.scala
def useShortJvmPath(jvmId: String): Boolean

Attributes

Inherited from:
JavaHomeModule
Source
JavaHomeModule.scala