### Install Plugin Locally Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Installs the plugin to the local Maven repository after running integration tests. ```bash ./mvnw install ``` -------------------------------- ### Install Plugin Locally (Skip Tests) Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Installs the plugin to the local Maven repository, skipping both unit and integration tests. ```bash ./mvnw install -Dmaven.test.skip=true ``` -------------------------------- ### Control Scala Installation with scala.version and scalaHome Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Override the Scala version detected from the `scala-library` dependency or point to a local Scala installation to avoid downloading compiler artifacts. Configure `failOnMultipleScalaVersions` and `compileOrder`. ```xml 2.13.16 2.13 net.alchim31.maven scala-maven-plugin 4.9.2 true Mixed ``` ```bash # Override Scala version from command line mvn compile -Dscala.version=2.12.20 # Point to a local Scala installation mvn compile -Dscala.home=/opt/scala-2.13.16 ``` -------------------------------- ### Run Continuous Compilation with scala:cc / scala:cctest Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Start continuous compilation loops that watch for file changes. Use '-Donce=true' to run once, or 'scala:cctest' to include test execution. ```bash # Start continuous compilation loop (watches for file changes) mvn scala:cc # Run once (no loop) — useful in CI or editor integrations mvn scala:cc -Donce=true # Continuous compile + run tests on each successful compile mvn scala:cctest # Enable verbose output mvn scala:cc -Dverbose=true ``` -------------------------------- ### Configure Scala Maven Plugin for Incremental Compilation Source: https://github.com/davidb/scala-maven-plugin/wiki/Tips Enable incremental compilation for Scala projects using the maven-scala-plugin. Configure specific arguments for main and test compilation, including dependency file paths. This setup is available since Scala 2.8.0. ```xml org.scala-tools maven-scala-plugin 2.14.1 cmain compile -make:transitive -dependencyfile ${project.build.directory}/.main_scala_dependencies ctest testCompile -make:transitive -dependencyfile ${project.build.directory}/.test_scala_dependencies -Xms64m -Xmx1024m ``` -------------------------------- ### Configure Named Launchers for scala:run Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Define named configurations in pom.xml for common entry points. Supports arguments and JVM options for specific launchers. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 server com.example.ServerMain --port 8080 -Xmx512m migrate com.example.MigrationTool ``` -------------------------------- ### Generate Plugin Website Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Command to generate the plugin's website documentation using Maven. ```bash ./mvnw site ``` -------------------------------- ### Run Scala Main Class with scala:run Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Execute a Scala main class using a named launcher or an arbitrary class. Additional arguments can be passed via the command line. ```bash # Run using a named launcher defined in pom.xml mvn scala:run -Dlauncher=server # Run an arbitrary main class (not defined in pom.xml) mvn scala:run -DmainClass=com.example.App # Pass additional arguments from the command line (pipe-separated) mvn scala:run -DmainClass=com.example.App -DaddArgs="arg1|arg2|arg3" ``` -------------------------------- ### Run Scaladoc Generation Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Commands to generate Scaladoc HTML documentation or run the scala:doc goal directly. ```bash mvn site # generates Scaladoc under target/site/scaladocs/ ``` ```bash mvn scala:doc # run directly ``` -------------------------------- ### Launch Scala REPL with scala:console Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Launch the Scala REPL. Compile first to ensure the latest classes are available, or specifically include test-compiled classes. ```bash # Compile first, then launch REPL with compiled classes on classpath mvn compile scala:console # Launch REPL with test-compiled classes available mvn test-compile scala:console ``` -------------------------------- ### Manual Release Deployment Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md A comprehensive manual command for deploying a release, including generating artifacts, signing, and deploying to repositories. Requires manual closing and releasing of staging repositories on OSS Sonatype. ```bash ./mvnw site package source:jar javadoc:jar install:install gpg:sign deploy:deploy changes:announcement-generate -Dmaven.test.skip=true -DperformRelease=true ``` -------------------------------- ### Release Plugin (Standard) Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Standard Maven release process to prepare and perform a release, publishing to a staging repository. ```bash ./mvnw release:clean && ./mvnw release:prepare && ./mvnw release:perform ``` -------------------------------- ### Run Integration Tests Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Executes all integration tests for the plugin. Ensure the 'scala.home' property is correctly set in 'src/it/test_scalaHome/pom.xml' if needed. ```bash ./mvnw integration-test ``` -------------------------------- ### Build Plugin Jar Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Use this command to package the Scala Maven Plugin into a JAR file. ```bash ./mvnw package ``` -------------------------------- ### Run Package Goal to Produce Scaladoc JAR Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Execute the Maven package goal to produce the main artifact along with the associated -javadoc.jar. ```bash mvn package # produces myartifact-1.0-javadoc.jar alongside the main jar ``` -------------------------------- ### Release Plugin (Skip Tests) Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Prepares and performs a plugin release, skipping tests during the process. This is useful for faster releases, especially in CI environments. ```bash ./mvnw release:clean && ./mvnw release:prepare -Darguments="-DskipTests -Dmaven.test.skip=true" && ./mvnw release:perform -Darguments="-DskipTests -Dmaven.test.skip=true" ``` -------------------------------- ### Register Scala Source Directories and Compile Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Register Scala source directories and bind compile goals to Maven lifecycle phases. Ensure Scala sources are discovered by IDEs and other plugins. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 scala-add-source add-source scala-compile compile testCompile ${project.basedir}/src/main/scala ${project.basedir}/src/test/scala ``` -------------------------------- ### Configure Scala 3 Project with Scala Maven Plugin Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Set up a Maven project to use Scala 3 by declaring the Scala 3 library dependency and configuring the scala-maven-plugin. The plugin auto-detects Scala 3. ```xml 3 3.4.1 org.scala-lang scala3-library_${scala.compat.version} ${scala.version} net.alchim31.maven scala-maven-plugin 4.9.2 compile testCompile -encoding UTF-8 ``` -------------------------------- ### Configure REPL Classpath with scala:console Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Customize the classpath for the Scala REPL. Use test-scope classes and runtime dependencies by setting specific configuration properties. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 true true ``` -------------------------------- ### Command Line Compilation Options Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Control Scala compilation from the command line. Skip main source compilation or force batch recompilation. Pass extra scalac flags without modifying the POM. ```bash # From the command line mvn compile # Skip main source compilation mvn compile -Dmaven.main.skip=true # Force batch recompile mvn compile -DrecompileMode=all # Pass extra scalac flags without editing pom.xml mvn compile -DaddScalacArgs="-Xfatal-warnings|-Xlint" ``` -------------------------------- ### Configure Surefire for Scala Test Execution Source: https://github.com/davidb/scala-maven-plugin/wiki/Frequently-Asked-Questions Add this configuration to the surefire plugin to set up the argument line for executing Scala tests, including the Scala library path. ```xml -Xbootclasspath/p:${settings.localRepository}/org/scala-lang/scala-library/${scala.version}/scala-library-${scala.version}.jar ``` -------------------------------- ### Run Scala Test Compilation Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Execute the Scala test compilation process using Maven. Includes an option to skip test compilation. ```bash mvn test-compile ``` ```bash mvn test-compile -Dmaven.test.skip=true # skips test compilation ``` -------------------------------- ### Build Project for Multiple Scala Versions Source: https://github.com/davidb/scala-maven-plugin/wiki/Frequently-Asked-Questions To build a project configured for cross-Scala versions, invoke Maven multiple times, specifying the desired Scala version for each build. ```sh #! /bin/sh for v in 2.8.1 2.9.1 2.9.2 ; do mvn -DscalaVersion=$v $* done ``` -------------------------------- ### Execute Scala Script with scala:script Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Execute Scala scripts, either embedded in the POM or from an external file. Configure script inclusion scopes and whether to keep generated files. ```bash mvn validate # runs the inline script during the validate phase mvn scala:script -DscriptFile=scripts/my-task.scala ``` -------------------------------- ### Configure Continuous Compilation Tuning Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Optional tuning for continuous compilation modes (scala:cc and scala:cctest). Set recompile mode for incremental compilation. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 incremental ``` -------------------------------- ### Run Specific Integration Test Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Allows running a specific integration test by its name, useful for debugging or tuning. ```bash ./mvnw integration-test -Dinvoker.test=test1 ``` -------------------------------- ### GPG Signature for Release Source: https://github.com/davidb/scala-maven-plugin/blob/master/README.md Command to create a detached GPG signature for the pom.xml file. This is a workaround for potential GPG issues on macOS during the release process. ```bash gpg --use-agent --armor --detach-sign --output $(mktemp) pom.xml ``` -------------------------------- ### Add Compiler Plugins to Scala Maven Plugin Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Apply scalac compiler plugins like kind-projector or better-monadic-for to all compilations by listing them under ``. The plugin resolves them from Maven repositories and automatically passes `-Xplugin:` arguments to scalac. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 compile testCompile doc-jar org.typelevel kind-projector_2.13.16 0.13.3 com.olegpy better-monadic-for_2.13 0.3.1 ``` -------------------------------- ### Compile Scala 2.13 Project with Incremental Compilation Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Configure Scala compilation for a Scala 2.13 project using incremental compilation and specify compiler and JVM arguments. Ensure correct Scala library version is included. ```xml org.scala-lang scala-library 2.13.16 net.alchim31.maven scala-maven-plugin 4.9.2 scala-compile-first process-resources compile scala-test-compile process-test-resources testCompile incremental -encodingUTF-8 -deprecation -unchecked -feature -Xms256m -Xmx1g ``` -------------------------------- ### Configure Scaladoc Generation with Maven Site Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Enable Scaladoc generation during the Maven site lifecycle phase. This configuration integrates the scala-maven-plugin's doc goal with the site reporting mechanism. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 compile ${project.name} ${project.version} API net.alchim31.maven scala-maven-plugin 4.9.2 ``` -------------------------------- ### Cross Building for Multiple Scala Versions in Maven Source: https://github.com/davidb/scala-maven-plugin/wiki/Frequently-Asked-Questions Configure your pom.xml to support cross-building for different Scala versions by adjusting artifact IDs, managing dependencies, and using profiles for version-specific configurations. ```xml scala-maven-plugin_${scalaVersion} ``` ```xml y.x z_${scalaVersion} 0.0 ``` ```xml scala-2.9.0 scalaVersion 2.9.0 ... ``` ```xml org.codehaus.mojo build-helper-maven-plugin 1.5 add-source generate-sources add-source src/main/scala_${scalaVersion} ``` -------------------------------- ### Configure Scala Test Compilation with Javac Flags Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Configure separate compilation for Scala test sources with specific javac flags. This snippet shows how to set arguments for both the Scala compiler and javac. ```xml scala-test-compile process-test-resources testCompile incremental -deprecation -unchecked -Xlint:unchecked -Xlint:deprecation ${project.build.directory}/analysis/test-compile ``` -------------------------------- ### Package Scaladoc into a JAR Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Configure the scala-maven-plugin to generate Scaladoc HTML and package it into a -javadoc.jar artifact, typically during the package phase. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 scala-compile compile attach-scaladocs doc-jar ``` -------------------------------- ### Configure Mixed Java and Scala Compilation in Maven Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Coordinate with the Maven compiler plugin for projects containing both Java and Scala sources. The recommended pattern is to run `scala:compile` and `scala:testCompile` before the Java compiler in their respective phases. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 scala-compile-first process-resources compile scala-test-compile process-test-resources testCompile org.apache.maven.plugins maven-compiler-plugin 3.13.0 1.8 1.8 ``` -------------------------------- ### Configure Source Includes and Excludes in Scala Maven Plugin Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Control which source files are passed to the compiler using Ant-style glob patterns. Filters apply to all compilation goals. By default, the plugin includes `**/*.scala` and `**/*.java`. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 compile testCompile **/*.scala **/MyJavaClass.java **/generated/** bad.scala false ``` -------------------------------- ### Specify Scalac Recompilation Strategy Source: https://github.com/davidb/scala-maven-plugin/wiki/Frequently-Asked-Questions Use this configuration to specify the recompilation detection strategy for scalac, supporting options like 'transitive'. ```xml -make:transitive ``` -------------------------------- ### Configure Inline Scala Script for scala:script Source: https://context7.com/davidb/scala-maven-plugin/llms.txt Embed a Scala script directly within the pom.xml for custom build automation. The script receives Maven project objects. ```xml net.alchim31.maven scala-maven-plugin 4.9.2 print-info validate script ``` -------------------------------- ### Skip Tests with Maven Property Source: https://github.com/davidb/scala-maven-plugin/wiki/Tips To skip running tests during a Maven build, use the '-Dmaven.test.skip=true' property on the command line. This is a convenient way to bypass tests without modifying your pom.xml. ```bash mvn .... -Dmaven.test.skip=true ``` -------------------------------- ### Configure Recompilation Mode in Maven Source: https://github.com/davidb/scala-maven-plugin/wiki/Frequently-Asked-Questions To re-enable recompiling only modified files in Scala-Maven-Plugin versions 2.13+, configure the recompilation mode via the plugin configuration or a system property. ```xml modified-only ``` ```properties -Drecompilation-mode=modified-only ``` -------------------------------- ### Disable Tests in pom.xml Source: https://github.com/davidb/scala-maven-plugin/wiki/Tips To permanently disable tests by editing the pom.xml, add the 'maven.test.skip' property within the '' section. This method is preferred as it doesn't require a Surefire configuration and respects profile-specific test execution. ```xml true ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.