scalor-maven-plugin icon indicating copy to clipboard operation
scalor-maven-plugin copied to clipboard

Scala library doesn't get picked if it's in test scope

Open slandelle opened this issue 7 years ago • 3 comments

Hello,

I have a project (Gatling based) that only contains test sources, hence only test dependencies (that pull scala-library transitively).

I then get the following crash:

java.lang.RuntimeException: Missing library, see: defineAuto, regexScalaLibrary.
at com.carrotgarden.maven.scalor.util.Error$Throw$.apply (Error.scala:34)
at com.carrotgarden.maven.scalor.base.ParamsCompiler.$anonfun$defineFindLibrary$1 (Params.scala:253)
at scala.Option.getOrElse (Option.scala:121)
at com.carrotgarden.maven.scalor.base.ParamsCompiler.defineFindLibrary (Params.scala:253)
at com.carrotgarden.maven.scalor.base.ParamsCompiler.defineFindLibrary$ (Params.scala:251)
at com.carrotgarden.maven.scalor.CompileMainMojo.defineFindLibrary (CompileMojo.scala:113)

Things work if I change the scope of the library to compile, but it's not right. I'd like to advertise this plugin to Gatling users, but this one is a blocker for me.

slandelle avatar Jul 25 '18 21:07 slandelle

@Andrei-Pozolotin gentle ping

slandelle avatar Aug 20 '18 13:08 slandelle

The problem is that resolveCustomInstall triggers at compile phase, but MavenProject#getArtifacts is lazily populated and only contains test artifacts at test phase.

Maybe compile phase should be bypassed upstream if there's nothing to compile (src/main doesn't contain any *.scala files).

WDYT?

slandelle avatar Aug 20 '18 15:08 slandelle

ok, thinking

Andrei-Pozolotin avatar Apr 28 '19 17:04 Andrei-Pozolotin