question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running mvn scala:run without compiling again

See original GitHub issue

I’m running mvn scala:compile and then mvn scala:run.

But seems that mvn scala:run is calling the compile and skipping it because files are already there. Is there an option to run it wuthout checking?

$ mvn scala:run -DmainClass=example.Hello
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< com.example:sample-scala-hbase >-------------------
[INFO] Building Sample Scala HBase App 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> scala-maven-plugin:3.3.2:run (default-cli) > test-compile @ sample-scala-hbase >>>
Downloading from apache.snapshots: https://repository.apache.org/snapshots/net/minidev/json-smart/maven-metadata.xml
Downloading from apache.snapshots.https: https://repository.apache.org/content/repositories/snapshots/net/minidev/json-smart/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/net/minidev/json-smart/maven-metadata.xml
Downloading from dynamodb-local-oregon: https://s3-us-west-2.amazonaws.com/dynamodb-local/release/net/minidev/json-smart/maven-metadata.xml
Downloading from repository.jboss.org: https://repository.jboss.org/nexus/content/groups/public/net/minidev/json-smart/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/net/minidev/json-smart/maven-metadata.xml (1.2 kB at 934 B/s)
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sample-scala-hbase ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ sample-scala-hbase ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- scala-maven-plugin:3.3.2:compile (default) @ sample-scala-hbase ---
[WARNING]  Expected all dependencies to require Scala version: 2.13.8
[WARNING]  com.example:sample-scala-hbase:1.0.0 requires scala version: 2.13.8
[WARNING]  org.scalameta:munit_2.13:0.7.29 requires scala version: 2.13.6
[WARNING] Multiple versions of scala libraries detected!
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ sample-scala-hbase ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\projects\sample-scala-hbase\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ sample-scala-hbase ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- scala-maven-plugin:3.3.2:testCompile (default) @ sample-scala-hbase ---
[WARNING]  Expected all dependencies to require Scala version: 2.13.8
[WARNING]  com.example:sample-scala-hbase:1.0.0 requires scala version: 2.13.8
[WARNING]  org.scalameta:munit_2.13:0.7.29 requires scala version: 2.13.6
[WARNING] Multiple versions of scala libraries detected!
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< scala-maven-plugin:3.3.2:run (default-cli) < test-compile @ sample-scala-hbase <<<
[INFO]
[INFO]
[INFO] --- scala-maven-plugin:3.3.2:run (default-cli) @ sample-scala-hbase ---
[WARNING]  Expected all dependencies to require Scala version: 2.13.8
[WARNING]  com.example:sample-scala-hbase:1.0.0 requires scala version: 2.13.8
[WARNING]  org.scalameta:munit_2.13:0.7.29 requires scala version: 2.13.6
[WARNING] Multiple versions of scala libraries detected!
hello
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.812 s
[INFO] Finished at: 2022-06-15T00:00:39+10:00
[INFO] ------------------------------------------------------------------------

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
slandellecommented, Jun 18, 2022

Is it possible to build a fat jar with scala-maven-plugin? Similar to what maven-assembly-plugin does?

Well, just use use maven-assembly-plugin then. It would work just fine.

0reactions
rsibanez89commented, Jun 18, 2022

Thanks again @slandelle, my goal was to use the scala-maven-plugin for CI/CD. Building and packaging in one machine, and then running it on the other machine, without trying to compile again. Is it possible to build a fat jar with scala-maven-plugin? Similar to what maven-assembly-plugin does?

# build an package in one agent
mvn package

# running it in production machine
java -jar target/scala-docker-example-1.0.0-jar-with-dependencies.jar

Maybe that is not the goal of the scala-maven-plugin. The scala-maven-plugin is just for local development?

Sorry these basics questions, I’m new to scala.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven skip compile - java - Stack Overflow
Set this to 'true' to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on occasion. User property is:...
Read more >
Scala with Maven
Note: the plugin includes Scala from the Central Repository so there's no need to install it yourself if you're compiling with Maven.
Read more >
scala-maven-plugin – Example
Running a "main(args: Array[String])". You must have a well define project, and it must compile your code successfully before (see Compiling ).
Read more >
Run script in execution doesn't work · Issue #31 - GitHub
I start to rewrite the way classpath is define for running script, and it should allow running script like in the book (I...
Read more >
Upgrade to Scala 2.11, mvn scala:cc error: "Could not connect ...
... (mvn scala:cc). (Normal compilation works fine, and switching back to 2.9 cc works again): ... [No compilation server running.] [INFO] start server....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found