Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

scala - Problem Building a Java Play Application using Maven - Sass compiler Unknown error, try running sass directly

I am trying to build a play framework app using maven, I am using MacOS Catalina.

I have configured:

  • Maven all working by itself
  • Using java 1.7
  • Installed SBT and on path
  • Installed Scala 2.11.6

My problem after cloning the repo from bitbucket and importing as SBT in Intellij. mvn clean install fails.

It fails at the test stage with the following error:

     java.lang.Exception: 
        Sass compiler: Unknown error, try running sass directly
        File: application.scss
        Line: 0 Col: Some(0)
                at sass.SassCompiler$.compile(SassCompiler.scala:35)
                at sass.SbtSass$$anonfun$5$$anonfun$6$$anonfun$7.apply(SbtSass.scala:55)
                at sass.SbtSass$$anonfun$5$$anonfun$6$$anonfun$7.apply(SbtSass.scala:43)
                at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
                at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
                at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
                at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
                at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
                at scala.collection.AbstractTraversable.map(Traversable.scala:105)
                at sass.SbtSass$$anonfun$5$$anonfun$6.apply(SbtSass.scala:43)
                at sass.SbtSass$$anonfun$5$$anonfun$6.apply(SbtSass.scala:39)
                at com.typesafe.sbt.web.incremental.package$.syncIncremental(package.scala:228)
                at sass.SbtSass$$anonfun$5.apply(SbtSass.scala:38)
                at sass.SbtSass$$anonfun$5.apply(SbtSass.scala:33)
                at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
                at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
                at sbt.std.Transform$$anon$4.work(System.scala:63)
                at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
                at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
                at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
                at sbt.Execute.work(Execute.scala:237)
                at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
                at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
                at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
                at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
                at java.util.concurrent.FutureTask.run(FutureTask.java:262)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
                at java.util.concurrent.FutureTask.run(FutureTask.java:262)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
                at java.lang.Thread.run(Thread.java:748)
        [error] (web-assets:sass) java.lang.Exception: 
        [error] Sass compiler: Unknown error, try running sass directly
        [error] File: application.scss

[error] Line: 0 Col: Some(0)
[error] Total time: 26 s, completed 21-Jan-2021 22:31:21
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:29 min
[INFO] Finished at: 2021-01-21T22:31:21Z
[INFO] ------------------------------------------------------------------------

    [ERROR] Failed to execute goal org.nanoko.playframework:play2-maven-plugin:1.2.5:test (default-test) on project user-portal: Error during compilation: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.nanoko.playframework:play2-maven-plugin:1.2.5:test (default-test) on project vdr-customer-portal: Error during compilation
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
        at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke (Method.java:607)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    Caused by: org.apache.maven.plugin.MojoExecutionException: Error during compilation
        at org.nanoko.playframework.mojo.Play2TestMojo.execute (Play2TestMojo.java:93)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
        at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke (Method.java:607)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
        at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:377)
        at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:160)
        at org.nanoko.playframework.mojo.Play2TestMojo.execute (Play2TestMojo.java:88)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
        at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
        at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
        at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
        at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke (Method.java:607)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

I did install sass as follows and rerun the build, but no luck:

brew install sass/sass/sass

And checked it was successfully installed :

sass --version

That did not fix. I saw a post that says node-sass should be used instead and I did try that but no luck.

POM has

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.7</java.version>
        <junit.version>4.10</junit.version>
        <scala.majorminor.version>2.11</scala.majorminor.version>
        <scala.version>${scala.majorminor.version}.4</scala.version>
        <play.version>2.3.4</play.version>
        <joda.version>2.2</joda.version>
        <jackson.version>2.8.9</jackson.version>
        <slf4j.version>1.7.5</slf4j.version>
        <log4j.version>1.2.17</log4j.version>
        <logback.version>1.1.1</logback.version>
     
    </properties>

     <plugin>
                    <groupId>org.nanoko.playframewor

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The main cause was the following lines in the stack posted:

[error] (web-assets:sass) java.lang.Exception: [error] Sass compiler: Unknown error, try running sass directly [error] File: application.scss

After installing the sass compiler using brew, both outside and from within IntelliJ IDE, my scss was not getting compile automatically in when the Play application is run.

As part of trouble shooting I installed Code and used the Live Scss compiler to compile the culprit files. See https://marketplace.visualstudio.com/items?itemName=ritwickdey.live-sass

This fixed the mvn clean package and then the application started OK.

There should be a more stable fix of auto compiling the scss files. Any ideas will be good.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...