Code Monkey home page Code Monkey logo

libsass-maven-plugin's Introduction

Unmaintained

this project is no longer maintained but a fork is: https://gitlab.com/haynes/libsass-maven-plugin

Libsass Maven Plugin Build Status Maven Central

Libsass Maven Plugin uses libsass to compile sass files. Uses jsass to interface with C-library.

Changelog:

  • 0.2.10 - upgraded libsass to 3.5.3
  • 0.2.9 - upgraded libsass to 3.4.7
    • refreshed output files for eclipse
    • enhanced error output with failing files - thanks to @VsevolodGolovanov
  • 0.2.8 - upgraded libsass to 3.4.4
    • used compilation classpath for including webjars
    • fixed issue with os-dependent path-separator (using ';' for every OS)
    • plugin now aware of incremental builds
  • 0.2.7 - upgraded libsass to 3.4.3
    • added webjar support - thanks to @flipp5b
  • 0.2.6 - upgraded libsass to 3.4.0
    • added libsass:watch goal to watch and recompile include directory - thansk to @lorenzodee
  • 0.2.5 - added copySourceToOutput, changed default outputstyle to 'nested', upgraded libsass to 3.3.6
  • 0.2.4 - fixed bug with empty spaces in path
  • 0.2.3 - upgrade to libsass 3.3.4
  • 0.2.2 - minor bugfixes, readded m2e lifecycle mapping
  • 0.2.1 - updated libsass to 3.3.3
  • 0.2.0 - switched native bindings to bit3 bindings (using libsass 3.3.2), java8-only
  • 0.1.7 - UTF8 encoding issue, used wrong file extension for sass style
  • 0.1.6 - added m2e eclipse intergation, thanks @dashorst
  • 0.1.5 - readded macOs binaries, thanks @tommix1987
  • 0.1.4 - added contained libsass-version to artifact-version (e.g. 0.1.4-libsass_3.2.4-SNAPSHOT).
    • switched to new libsass API (sass_context.h)
    • removed image_path option (because of #420)
    • added failOnError flag to skip errors and continue the build, if wanted
  • 0.1.3 - fixed #10 - multi-module projects
  • 0.1.2 - added PR #4, updated to libsass version 3.1 for windows, linux, macos - thanks to @npiguet, @ogolberg
  • 0.1.1 - scss files can now be placed in inputpath/ directly
  • 0.1.0 - changed artefact group to com.github.warmuuh

Installation

libsass-maven-plugin is available on central-repository since version 0.1.2

Usage

Configure plugin in your pom.xml:

<build>
   <plugins>
      <plugin>
         <groupId>com.github.warmuuh</groupId>
         <artifactId>libsass-maven-plugin</artifactId>
         <version><VERSION>-libsass_3.4.4</version>
         <executions>
            <execution>
               <phase>generate-resources</phase>
               <goals>
                  <goal>compile</goal>
               </goals>
            </execution>
         </executions>
         <configuration>
            <inputPath>${basedir}/src/main/sass/</inputPath>
            <outputPath>${basedir}/target/</outputPath>
            <includePath>${basedir}/src/main/sass/plugins/</includePath>
         </configuration>
      </plugin>
   </plugins>
</build>

Alternatively, you can use the watch goal to have the plugin watch your files and recompile on change:

mvn com.github.warmuuh:libsass-maven-plugin:<version>-libsass_3.4.4:watch

Configuration Elements

Element Default value Documentation
outputPath ${project.build.directory} The directory in which the compiled CSS files will be placed.
inputPath src/main/sass The directory from which the source .scss files will be read. This directory will be traversed recursively, and all .scss files found in this directory or subdirectories will be compiled.
includePath null Additional include path, ';'-separated
outputStyle nested Output style for the generated css code. One of nested, expanded, compact, compressed. Note that as of libsass 3.1, expanded and compact result in the same output as nested.
generateSourceComments false Emit comments in the compiled CSS indicating the corresponding source line. The default value is false.
generateSourceMap true Generate source map files. The generated source map files will be placed in the directory specified by sourceMapOutputPath.
sourceMapOutputPath ${project.build.directory} The directory in which the source map files that correspond to the compiled CSS will be placed
omitSourceMapingURL false Prevents the generation of the sourceMappingURL special comment as the last line of the compiled CSS.
embedSourceMapInCSS false Embeds the whole source map data directly into the compiled CSS file by transforming sourceMappingURL into a data URI.
embedSourceContentsInSourceMap false Embeds the contents of the source .scss files in the source map file instead of the paths to those files
inputSyntax scss Switches the input syntax used by the files to either sass or scss.
precision 5 Precision for fractional numbers
enableClasspathAwareImporter false Enables classpath aware importer which make possible to @import files from classpath and WebJars. For classpath resources use @import 'path/to/resource/in/classpath';. For WebJar resources a shortcut can be used: @import '{package}/{path}'; imports resource META-INF/resources/webjars/{package}/{version}/{path}.
failOnError true should fail the build in case of compilation errors.
copySourceToOutput false copies all files from source directory to output directory

License

MIT License.

libsass-maven-plugin's People

Contributors

artur- avatar beinacht avatar betermieux avatar danny02 avatar dashorst avatar flipp5b avatar larsgrefer avatar lorenzodee avatar moosemorals avatar npiguet avatar onigoetz avatar rottina avatar tomaszsoczyk-cognifide avatar tristanlins avatar vsevolodgolovanov avatar warmuuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libsass-maven-plugin's Issues

WebJar support

Is there any way to use WebJars with this plugin?
I mean, if I want to use some Sass library, e.g. Susy, in my app, I should @import it to my scss file. But if the lib is added to pom as a WebJar dependency, the question is how to specify path to the lib in @import.

Two unit tests fail on OSX

  1. testDefaultPrecision expects .something{padding:0 0.8em .71429 0.8em} but gets .something{padding:0 0.8em 0.71429 0.8em}
  2. testHighPrecision expects
    .something{padding:0 0.8em .7142857143 0.8em} but gets .something{padding:0 0.8em 0.7142857143 0.8em}

System Information:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.3", arch: "x86_64", family: "mac"

libsass.dylib for mac os is missing in latest version of plugin

I'm getting a build failure currently when trying to use the plugin on Mac OS machines. I can see from history that file was removed recently while moving to newer version of libsass. Could file be added again to the library, recompiling it on each mac is bit painful and breaks the idea of maven dependencies being automatically downloaded from repository and doing their job immediately. Was there any particular reason to delete the file?
[PS] I'm seeing in the other issue that someone had a problem with 32bit windows JVM. Suggestion from @warmuuh was to create a pull request, shall I compile mac version of it and create a PR as well?

Why don't you separate SassCompiler and libsass-maven-plugin project?

Your project is the savior for web front-end developers which work with java based server applications.

If you separate this project to two different projects for example "libsass-java-compiler" and "libsass-maven-plugin"(which depends on libsass-java-compiler), "libsass-java-compiler" will be the base project for other many java build tools' sass plugins(like ant, gradle, sbt, buildr,... or even servlet filter for sass).

Compilation fails on Linux x64

Hi, i'm using this plugin on a project of mine.

The project builds correctly on my Windows x64, but not on Jenkins (which is on a Linux Red Hat x64 VM), the stack trace is the following:

[ERROR] Failed to execute goal com.github.warmuuh:libsass-maven-plugin:0.1.7-libsass_3.2.4:compile (compile-css) on project my-theme: Execution compile-css of goal com.github.warmuuh:libsass-maven-plugin:0.1.7-libsass_3.2.4:compile failed: An API incompatibility was encountered while executing com.github.warmuuh:libsass-maven-plugin:0.1.7-libsass_3.2.4:compile: java.lang.UnsatisfiedLinkError: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by /tmp/jna-96325345/jna9137927073831261571.tmp)
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.github.warmuuh:libsass-maven-plugin:0.1.7-libsass_3.2.4
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/opt/application/myapp/.m2/repository/com/github/warmuuh/libsass-maven-plugin/0.1.7-libsass_3.2.4/libsass-maven-plugin-0.1.7-libsass_3.2.4.jar
[ERROR] urls[1] = file:/opt/application/myapp/.m2/repository/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar
[ERROR] urls[2] = file:/opt/application/myapp/.m2/repository/com/nativelibs4java/jnaerator-runtime/0.12/jnaerator-runtime-0.12.jar

Thank you

JVM Crashes When Trying To Run Commands From Command Line

Plugin Version: 0.2.9-libsass_3.4.4
OS: Windows 10
Java Version: 8

When I try to run mvn -X com.github.warmuuh:libsass-maven-plugin:0.2.9-libsass_3.4.4:watch (or compile) the Java instance running the command crashes when it tries to compile the first scss file. I get no logging output after this line attempts to execute: https://github.com/warmuuh/libsass-maven-plugin/blob/master/src/main/java/wrm/libsass/SassCompiler.java#L45. Thus I have no idea what the problem is.

However, it works just fun when I build my project in NetBeans and all my scss files are compiled.

Fail on Teamcity and Mac

When I run this on my local it builds just fine but if I try to run maven on Teamcity or if another developer runs on Mac gets error also...here is my config:

<plugin> <groupId>com.github.warmuuh</groupId> <artifactId>libsass-maven-plugin</artifactId> <version>0.2.4-libsass_3.3.4</version> <executions> <execution> <id>compile-sass</id> <goals> <goal>compile</goal> </goals> <configuration> <inputPath>${project.basedir}/src/main/content/jcr_root/etc/designs/namespace/styles</inputPath> <outputPath>${project.basedir}/src/main/content/jcr_root/etc/designs/namespace/css</outputPath> <includePath>${project.basedir}/src/main/content/jcr_root/etc/designs/namespace/sass;${project.basedir}/src/main/content/jcr_root/etc/designs/namespace/sass/Folder</includePath> <outputStyle>compressed</outputStyle> <generateSourceMap>true</generateSourceMap> <sourceMapOutputPath>${project.basedir}/src/main/content/jcr_root/etc/designs/namespace/css</sourceMapOutputPath> <omitSourceMapingURL>true</omitSourceMapingURL> </configuration> </execution> </executions> </plugin>

Segfaults in Docker container with Alpine Linux

When running the plugin in Alpine Linux, it segfaults the JVM:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000000000b3eb6, pid=25403, tid=0x00007f81e898fae8
#
# JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11)
# Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 3.4.0
# Distribution: Custom build (Fri Jun 16 13:41:54 GMT 2017)
# Problematic frame:
# C  0x00000000000b3eb6
#
# Core dump written. Default location: /builds/project/project/core or core.25403
#
# An error report file with more information is saved as:
# /builds/project/project/hs_err_pid25403.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
#
/bin/bash: line 93: 25403 Segmentation fault      (core dumped) mvn -B -e test ${MVN_ARGS}

Sourcemaps break under special conditions

We're getting a bug with wrong source maps being produced - mapping to wrong files, wrong lines.

It could be sass/libsass#2319 Sourcemaps break when output set to compressed and variable interpolation
which was closed in
sass/libsass#2541 Make sourcemaps fully unicode aware
that's in 3.5.0. We do have unicode characters in comments.

Latest stable libsass is 3.5.2.
jsass seems up to date, it currently says that it supports 3.5.2.

So it would be great if libsass-maven-plugin supported the latest and greatest.

handle escaped unicode

Hi,

it seems as if there are some encoding problems in your plugin.
When I try to compile font-awesome with this plugin on Windows all:

$fa-var-asterisk: "\f069";

get turned into ->

.fa-asterisk:before {
content: "?";
}

Can't check SASS compilation errors

When compilation fails just the maven error for the failed libsass execution is shown.
How can I get what caused the error? I have lots of files and I can't stay hours each time to get why the compilation failed...

Error running in Multi-Module

If I use the plugin in a single module pom everything works fine.
If I use a multi module pom it fails to read the input files.
The same issue is, when i start the pom from a different folder using -f to define the pom.xml in a different path.

Output files have '.sass' extension, not '.css'

Hi there.

Currently we use phantomjs-maven-plugin and consider migrating to your plugin. A quick test shows that the generated output files have a '.sass' extension while we expect '.css'. Is there any way we can achieve that other than using another plugin to rename the files? Are we doing anything wrong when configuring the plugin, maybe?

Update: Maybe you want to see our plugin config:

<plugin>
    <groupId>com.github.warmuuh</groupId>
    <artifactId>libsass-maven-plugin</artifactId>
    <version>0.1.7-libsass_3.2.4</version>
    <executions>
        <execution>
            <id>generate-css</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <!--<imgPath>../img</imgPath>-->
        <inputPath>${basedir}/src/main/webapp/resources/sass</inputPath>
        <outputPath>${project.build.directory}/css</outputPath>
        <includePath>${basedir}/src/main/webapp/resources/bootstrap;${basedir}/src/main/webapp/resources/sass</includePath>
        <generateSourceMap>false</generateSourceMap>
        <inputSyntax>sass</inputSyntax>
    </configuration>
</plugin>

Update 2: I managed to work around the issue like this, but it is ugly:

<plugin>
    <groupId>com.coderplus.maven.plugins</groupId>
    <artifactId>copy-rename-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <id>fix-css-file-names</id>
            <phase>process-resources</phase>
            <goals>
                <goal>rename</goal>
            </goals>
            <configuration>
                <fileSets>
                    <fileSet>
                        <sourceFile>${project.build.directory}/css/main.sass</sourceFile>
                        <destinationFile>${project.build.directory}/css/main.css</destinationFile>
                    </fileSet>
                    <fileSet>
                        <sourceFile>${project.build.directory}/css/styles.sass</sourceFile>
                        <destinationFile>${project.build.directory}/css/styles.css</destinationFile>
                    </fileSet>
                </fileSets>
            </configuration>
        </execution>
    </executions>
</plugin>

Plugin fails with space characters in the path

When the path of the maven project contains a space character, the plugin fails to create the CSS file.

java.net.URISyntaxException: Illegal character in path at index 35: /home/jenkins/.jenkins/jobs/My Project Workspace/workspace/src/main/styles/styles.scss
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3063)
    at java.net.URI.<init>(URI.java:588)
    at io.bit3.jsass.importer.Import.<init>(Import.java:99)
    at io.bit3.jsass.adapter.NativeImporterWrapper.apply(NativeImporterWrapper.java:25)
    at io.bit3.jsass.adapter.NativeAdapter.compileFile(Native Method)
    at io.bit3.jsass.adapter.NativeAdapter.compile(NativeAdapter.java:43)
    at io.bit3.jsass.Compiler.compile(Compiler.java:166)
    at io.bit3.jsass.Compiler.compileFile(Compiler.java:116)
    at wrm.libsass.SassCompiler.compileFile(SassCompiler.java:41)
    at wrm.CompilationMojo.processFile(CompilationMojo.java:247)
    at wrm.CompilationMojo.access$000(CompilationMojo.java:32)
    at wrm.CompilationMojo$1.visitFile(CompilationMojo.java:170)
    at wrm.CompilationMojo$1.visitFile(CompilationMojo.java:165)
    at java.nio.file.Files.walkFileTree(Files.java:2670)
    at java.nio.file.Files.walkFileTree(Files.java:2742)
    at wrm.CompilationMojo.execute(CompilationMojo.java:165)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:364)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
    at hudson.remoting.UserRequest.perform(UserRequest.java:120)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

darwin missing

The latest release is missing the darwin precompiled library. Is that platform no longer supported?

The libsass API should be its own project

I think that just the JNA binding for libsass should be a separate project so it can be used independently of the maven plugin. Make the binding a dependency for the mojo. Then it can be used for other build tools or dynamic compilation.

m2e: incorrect error locations in Eclipse

Eclipse Problems view shows:

errsass

which is misleading, because if open the description (or Ctrl+C the error row) then you'd see

Description Resource Path Location Type
Error: Undefined variable: "$i".
on line 303 of ../../../argus/rep/TechService-3.20/workspace/server-app/inf-modules/webui/src/main/sass/p/_dataList.scss
from line 97 of ../../../argus/rep/TechService-3.20/workspace/server-app/inf-modules/webui/src/main/sass/argus.scss

*****************************************/
------------------------------------------^
(com.github.warmuuh:libsass-maven-plugin:0.2.10-libsass_3.5.3:compile:default-cli:generate-resources) argus.scss /webui/src/main/sass line 303 Maven Build Participant Problem

So location was correct in Problems view, but not the file. The file shown (argus.scss) is the one that imports everything.

Related problem: double clicking the error opens the wrong file, the importing one.

Error reporting should be smarter and specify the file immediately containing the error.

sass compilation fails in macOS Mojave 10.14.6 and Java 11

OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
Java version: 11.0.4, vendor: AdoptOpenJDK (build 11.0.4+11.2)
Plugin version: 0.2.10-libsass_3.5.3

The plugin throws an error when it runs with AdoptOpenJDK 11.0.4+11.2. It worked with AdoptOpenJDK 11.0.4+11 and earlier.

[ERROR] Failed to execute goal com.github.warmuuh:libsass-maven-plugin:0.2.10-libsass_3.5.3:compile (default) on project PROJECT-NAME: Execution default of goal com.github.warmuuh:libsass-maven-plugin:0.2.10-libsass_3.5.3:compile failed: An API incompatibility was encountered while executing com.github.warmuuh:libsass-maven-plugin:0.2.10-libsass_3.5.3:compile: java.lang.UnsatisfiedLinkError: /private/var/folders/rv/ksx523cj59g7ry121yycwn3c0000gn/T/libjsass-9722002274882154669/libjsass.dylib: dlopen(/private/var/folders/rv/ksx523cj59g7ry121yycwn3c0000gn/T/libjsass-9722002274882154669/libjsass.dylib, 1): no suitable image found.  Did find:
[ERROR]     /private/var/folders/rv/ksx523cj59g7ry121yycwn3c0000gn/T/libjsass-9722002274882154669/libjsass.dylib: code signature in (/private/var/folders/rv/ksx523cj59g7ry121yycwn3c0000gn/T/libjsass-9722002274882154669/libjsass.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

Linux error: "ELF file OS ABI invalid"

I see the following error on our Jenkins server (CentOS release 5.11):

An API incompatibility was encountered while executing
com.github.warmuuh:libsass-maven-plugin:0.1.7-libsass_3.2.4:compile:
  java.lang.UnsatisfiedLinkError:
    /tmp/jna-3506402/jna4265422068358906463.tmp: ELF file OS ABI invalid

I see that /tmp/jna-3506402/ is an empty directory after the build was aborted. Some more info:

$ uname -s -r -v -p -i -o
Linux 2.6.18-407.el5 #1 SMP Wed Nov 11 08:12:41 EST 2015 x86_64 x86_64 GNU/Linux

lifecycle-mapping-metadata.xml causes endless rebuild loop in Eclipse

In Eclipse, the libsass-maven-plugin's compile goal is executed on every project refresh, because
<runOnIncremental>true</runOnIncremental> is set in lifecycle-mapping-metadata.xml (#20).

This leads to ...

  1. an endless rebuild loop if "Refresh using native hooks or polling" is enabled in the Eclipse workspace settings, and
  2. prevents publishing the project to Tomcat, because of "Resource is out of sync with the file system: '/myProject/WebContent/resources/css/test.css'."

Plugin configuration:

  <plugin>
  	<groupId>com.github.warmuuh</groupId>
  	<artifactId>libsass-maven-plugin</artifactId>
  	<version>0.2.5-libsass_3.3.6</version>
   	<executions>
  		<execution>
  			<goals>
  				<goal>compile</goal>
  			</goals>
  		</execution>
  	</executions>
  	<configuration>
  		<inputPath>${basedir}/WebContent/resources/scss/</inputPath>
  		<outputPath>${basedir}/WebContent/resources/css/</outputPath>
  	</configuration>
  </plugin>

What happens:

  1. Refresh the project by pressing F5
  2. Incremental build event is triggered
  3. libsass-maven-plugin compiles test.scss -> test.css
  4. Eclipse detects the changed resource test.css and triggers the next incremental build (2.), and so on ...

Solution

To fix this, libsass-maven-plugin should only compile SCSS files that really have changed during incremental builds. For this, BuildContext should be used as described in the section "Making Maven plugins compatible" of the M2Eclipse documentation:

Mojos that runOnIncremental=true (the default), will be executed for any resource file, including all sources and generated files under target/. For performance and stability reasons it is absolutely essential to short-cut any time consuming work and all filesystem changes if there are no changes to the input sources processed by the mojo. For java code generating mojos, failure to act on relevant input changes only will almost certainly result in endless build โ€“ mojo generates .java files, which triggers jdt to generate .class files, which triggers the mojo to generate .java files, and so on.

!global sass flag is inrecognized

Hi once again!
I would like to compile foundation-sites with the tool.

Sass has a new flag called "!global" since version 3.3.0 (7 March 2014).
Unfortunatly with 0.2.6-libsass_3.4.0 i get
Syntax error: Invalid CSS after "...-flexbox: true ": expected "}", was "!global;"

The example can be found in

org.webjars.npm
foundation-sites
6.3.0

Look for the file foundation-sites-6.3.0.jar\META-INF\resources\webjars\foundation-sites\6.3.0\scss\foundation.scss

Thanks,
BlondCode

Specify a root directory when using the enableClasspathAwareImporter option

Add the ability to specify a root directory when using the enableClasspathAwareImporter option.

For example, let's imagine that all SASS files are located in a sass directory in each resources directory of each maven project. Currently we need to specify the complete path to import a SASS file: @import "sass/myFile". The idea is just to import the file without to specify sass: @import "myFile". This will be helpful to help IDE like IntelliJ to resolve file importations contained in other maven projects.

Changes not reflected until Maven Refresh

Hi,

I'm currently using this plugin with the latest version of the Spring Tool Suite (3.9.4) based on Eclipse Oxygen.3a (4.7.3a).

Whenever I perform changes in my SCSS files, I can see in Eclipse that the CSS files are also updated.
Howerver, my Spring Boot Application does not load the CSS file until I run a Maven Refresh (Alt + F5) and restart the project. Restarting without a refresh is not working either.

Am I missing a configuration setting or doing something wrong?

In my POM I'm using the following configuration:

<plugin>
	<groupId>com.github.warmuuh</groupId>
	<artifactId>libsass-maven-plugin</artifactId>
	<version>0.2.10-libsass_3.5.3</version>
	<executions>
		<execution>
			<phase>generate-resources</phase>
			<goals>
				<goal>compile</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<imgPath>../img</imgPath>
		<generateSourceMap>false</generateSourceMap>
		<inputPath>${basedir}/src/main/resources/static/scss/</inputPath>
		<outputPath>${basedir}/src/main/resources/static/css/</outputPath>
		<enableClasspathAwareImporter>true</enableClasspathAwareImporter>
	</configuration>
</plugin>

java.lang.TypeNotPresentException: Type wrm.CompilationMojo not present

Hi!
I wanted to replace the unsupported sass-maven-plugin with libsass-maven-plugin but i get the following error:
(Win7 x64, release 0.2.6-libsass_3.4.0, 0.2.5-libsass_3.3.6, ...)
I tried a bit more: last working version: 0.1.7-libsass_3.2.4

[DEBUG] Configuring mojo com.github.warmuuh:libsass-maven-plugin:0.2.5-libsass_3.3.6:compile from plugin realm ClassRealm[plugin>com.github.warmuuh:libsass-maven-plugin:0.2.5-libsass_3.3.6, parent: sun.misc.Launcher$AppClassLoader@799dbc3b]
[WARNING] Error injecting: wrm.CompilationMojo
java.lang.TypeNotPresentException: Type wrm.CompilationMojo not present
at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:147)
at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:517)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
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:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.UnsupportedClassVersionError: wrm/CompilationMojo : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:139)
... 48 more

Do you have any idea? Am i missing something?

Thanks,
BlondCode

Decimal litterals are truncated

I've encountered a strange behavior while using this plugin. For some reason all decimal litterals in my .scss file are truncated.

Here is an example of .scss code that causes the problem for me:

.sqw-contextMenu {
    li {
        a {
            padding: 0 0.8em 0 0.8em;
        }
    }
}

The code that is generated is the following:

sqw-contextMenu li a {
    padding: 0 0em 0 0em;
}

This happens with version 0.1.1 of libsass-maven-plugin on Ubuntu 14.04.

This issue was previously reported to libsass issue 923, but was closed as "cannot reproduce"

Sass files not picked up for compilation

In our project, we want to use the plugin to compile sass to css. Compiling scss works fine, but switching the following configuration to sass does not pick up *.sass files.

Maven output:

[INFO]
[INFO] --- libsass-maven-plugin:0.1.5-libsass_3.2.4:compile (default-cli) @ myproject ---
[INFO] Compiled 0 files

pom.xml:
        <plugin>
                <groupId>com.github.warmuuh</groupId>
                <artifactId>libsass-maven-plugin</artifactId>
                <version>0.1.5-libsass_3.2.4</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <imgPath>../img</imgPath>
                    <inputSyntax>sass</inputSyntax>
                    <inputPath>${basedir}/src/main/webapp/resources/stylesheets</inputPath>
                    <outputPath>${basedir}/src/main/webapp/resources/css</outputPath>
                    <includePath>${basedir}/src/main/webapp/resources/stylesheets/plugins/</includePath>
                    <outputStyle>nested</outputStyle>
                </configuration>
            </plugin>

Noob question about compiling sass files live

I'm looking to simply link sass files in a html doc and have a js library render them. Am I understanding that libsass does this? I really don't like having to compiling locally its a huge turn off and barrier to getting into Sass, I just want to link sass files and have a script render them live on the site.

Compilcation fails on Windows 7 x64

Hello, I am using the plugin in the following way(very standard way I would say):

<plugin>
                <groupId>com.github.warmuuh</groupId>
                <artifactId>libsass-maven-plugin</artifactId>
                <version>${libsass-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!--<imgPath>../img</imgPath>-->
                    <inputPath>${project.basedir}/src/main/resources/dynamic/scss</inputPath>
                    <outputPath>${project.build.outputDirectory}/static/css</outputPath>
                    <!--<includePath>${basedir}/src/main/sass/plugins/</includePath>-->
                </configuration>
            </plugin>

And it works fine under the linux. But on windows it fails and says:

[ERROR] Failed to execute goal com.github.warmuuh:libsass-maven-plugin:0.1.4-libsass_3.2.4:compile (default) on project web: Execution default of goal com.github.warmuuh:libsass-maven-plugin:0.1.4-libsass_3.2.4:compile failed: An API incompatibility was encounte
red while executing com.github.warmuuh:libsass-maven-plugin:0.1.4-libsass_3.2.4:compile: java.lang.UnsatisfiedLinkError: Unable to load library 'sass': Native library (win32-x86/sass.dll) not found in resource path ([file:/C:/Users/gcc/.m2/repository/com/github/
warmuuh/libsass-maven-plugin/0.1.4-libsass_3.2.4/libsass-maven-plugin-0.1.4-libsass_3.2.4.jar, file:/C:/Users/gcc/.m2/repository/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar, file:/C:/Users/gcc/.m2/repository/com/nativelibs4java/jnaerator-runtime/0.12/jnaerator-runt
ime-0.12.jar, file:/C:/Users/gcc/.m2/repository/com/nativelibs4java/ochafik-util/0.12/ochafik-util-0.12.jar, file:/C:/Users/gcc/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar, file:/C:/Users/gcc/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-
api-1.0.jar, file:/C:/Users/gcc/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar, file:/C:/Users/gcc/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar, file:/C:/Users/gcc/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.
jar, file:/C:/Users/gcc/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar, file:/C:/Users/gcc/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/gcc/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0
.0.0.M5/org.eclipse.sisu.inject-0.0.0.M5.jar, file:/C:/Users/gcc/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar, file:/C:/Users/gcc/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.19/plexus-interpolation-1.19.jar, file:
/C:/Users/gcc/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.15/plexus-utils-3.0.15.jar, file:/C:/Users/gcc/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar, file:/C:/Users/gcc/.m2/repository/org/s
onatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar, file:/C:/Users/gcc/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar])
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.github.warmuuh:libsass-maven-plugin:0.1.4-libsass_3.2.4
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/gcc/.m2/repository/com/github/warmuuh/libsass-maven-plugin/0.1.4-libsass_3.2.4/libsass-maven-plugin-0.1.4-libsass_3.2.4.jar
[ERROR] urls[1] = file:/C:/Users/gcc/.m2/repository/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar
[ERROR] urls[2] = file:/C:/Users/gcc/.m2/repository/com/nativelibs4java/jnaerator-runtime/0.12/jnaerator-runtime-0.12.jar
[ERROR] urls[3] = file:/C:/Users/gcc/.m2/repository/com/nativelibs4java/ochafik-util/0.12/ochafik-util-0.12.jar
[ERROR] urls[4] = file:/C:/Users/gcc/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[5] = file:/C:/Users/gcc/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
[ERROR] urls[6] = file:/C:/Users/gcc/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar
[ERROR] urls[7] = file:/C:/Users/gcc/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar
[ERROR] urls[8] = file:/C:/Users/gcc/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar
[ERROR] urls[9] = file:/C:/Users/gcc/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[10] = file:/C:/Users/gcc/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[11] = file:/C:/Users/gcc/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.0.0.M5/org.eclipse.sisu.inject-0.0.0.M5.jar
[ERROR] urls[12] = file:/C:/Users/gcc/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[13] = file:/C:/Users/gcc/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.19/plexus-interpolation-1.19.jar
[ERROR] urls[14] = file:/C:/Users/gcc/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.15/plexus-utils-3.0.15.jar
[ERROR] urls[15] = file:/C:/Users/gcc/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[16] = file:/C:/Users/gcc/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[17] = file:/C:/Users/gcc/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

The software:

  1. Windows 7 SP1 x64 Ultimate.
  2. java version "1.8.0_20"
    Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
    Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
  3. Apache Maven 3.2.5

Any suggestions?

Many thanks,
Vladimir Korobkov

Error handling seems to be broken

When I have a syntax error in my scss the plugin dies with a NPE:

Caused by: java.lang.NullPointerException
    at java.io.Writer.write(Writer.java:157)
    at wrm.CompilationMojo.writeContentToFile(CompilationMojo.java:275)
    at wrm.CompilationMojo.processFile(CompilationMojo.java:261)
    at wrm.CompilationMojo.access$000(CompilationMojo.java:32)
    at wrm.CompilationMojo$1.visitFile(CompilationMojo.java:170)
    at wrm.CompilationMojo$1.visitFile(CompilationMojo.java:165)
    at java.nio.file.Files.walkFileTree(Files.java:2670)
    at java.nio.file.Files.walkFileTree(Files.java:2742)
    at wrm.CompilationMojo.execute(CompilationMojo.java:165)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 21 more

out.getCss() seems to be null but no CompilationException is thrown

org.apache.maven.plugin.MojoExecutionException

I have add maven config to pom.xml as Usage section mention as below

<plugin>
    <groupId>com.github.warmuuh</groupId>
                <artifactId>libsass-maven-plugin</artifactId>
                <version>0.1.7-libsass_3.2.4</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <imgPath>../img</imgPath>
                    <inputPath>${basedir}/src/main/sass/</inputPath>
                    <outputPath>${basedir}/src/main/webapp/resources/css</outputPath>
                    <generateSourceMap>false</generateSourceMap>
                </configuration>
</plugin> 

And the eclipse notified me like this

Failed with 1 errors (com.github.warmuuh:libsass-maven-plugin:0.1.7-libsass_3.2.4:compile:default:generate-
 resources) org.apache.maven.plugin.MojoExecutionException: Failed with 1 errors at 
 wrm.CompilationMojo.execute(CompilationMojo.java:191) at 
 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at 
 org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) at 
 org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) 
 at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at 
 org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86) at 
 org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) at 
 org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734) at 
 org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at 
 org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205) at 
 org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245) at 
 org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300) at 
 org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at 
 org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303) at 
 org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359) at 
 org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382) at 
 org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at 
 org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235) at 
 org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Update to recent libsass

Wondering if we could get a libsass library upgrade in the near future. I believe the plugin is still based on libsass 3.1 (3.2.4 released recently). We are getting a lot of intermittent failures of "java.lang.Error: Invalid memory access" during compilation. They occur randomly and may fail in one run and then succeed immediately afterwards.

I'm hoping an upgrade to libsass might help as several bug fixes since 3.1 have been related to memory management.

Thanks, much appreciated!

ClasspathAwareImporter fails on empty imported file

I've been running into this exception in a project when using the ClasspathAwareImporter option:

java.util.NoSuchElementException
	at java.util.Scanner.throwFor(Scanner.java:862)
	at java.util.Scanner.next(Scanner.java:1371)
	at wrm.libsass.Lookup$Result.read(Lookup.java:53)
	at wrm.libsass.Lookup$Result.buildImport(Lookup.java:44)
	at wrm.libsass.ClasspathAwareImporter.lambda$apply$15(ClasspathAwareImporter.java:48)
	at java.util.Optional.map(Optional.java:215)
	at wrm.libsass.ClasspathAwareImporter.apply(ClasspathAwareImporter.java:48)
	at io.bit3.jsass.adapter.NativeImporterWrapper.apply(NativeImporterWrapper.java:39)
	at io.bit3.jsass.adapter.NativeAdapter.compileFile(Native Method)
	at io.bit3.jsass.adapter.NativeAdapter.compile(NativeAdapter.java:44)
	at io.bit3.jsass.Compiler.compile(Compiler.java:124)
	at io.bit3.jsass.Compiler.compileFile(Compiler.java:76)
	at wrm.libsass.SassCompiler.compileFile(SassCompiler.java:45)
	at wrm.AbstractSassMojo.processFile(AbstractSassMojo.java:285)
	at wrm.AbstractSassMojo$1.visitFile(AbstractSassMojo.java:180)
	at wrm.AbstractSassMojo$1.visitFile(AbstractSassMojo.java:175)
	at java.nio.file.Files.walkFileTree(Files.java:2670)
	at java.nio.file.Files.walkFileTree(Files.java:2742)
	at wrm.AbstractSassMojo.compile(AbstractSassMojo.java:175)
	at wrm.CompilationMojo.execute(CompilationMojo.java:41)
	at ... maven stuff

After adding some debugging output I've tracked it down:

Looking for elements/logo in <...>/src/main/sass/_app.scss
Optional[file:<...>/src/main/sass/elements/_logo.scss - /Users/qs/Projects/Cloud/trunk/kamala-cloud/src/main/sass/elements/_logo.scss]
Reading file:<...>/src/main/sass/elements/_logo.scss

Upon inspection, the _logo.scss file turns out to be empty. Re-running the compilation with a non-empty file fixes the exception.

I'm not sure on the use of Scanner, but this patch seems to do the trick:

--- a/src/main/java/wrm/libsass/Lookup.java
+++ b/src/main/java/wrm/libsass/Lookup.java
@@ -49,7 +49,9 @@
 
 		private static String read(URL url) {
 			try (Scanner scanner = new Scanner(url.openStream(), StandardCharsets.UTF_8.name())) {
-				return scanner.useDelimiter("\\A").next();
+				if (scanner.hasNext()) {
+					return scanner.useDelimiter("\\A").next();
+				} return "";
 			} catch (IOException e) {
 				throw new RuntimeException("Cannot read the url: " + url, e);
 			}

Allow data context usage

It would be great if the API also provided access to data contexts, so that the sass input can be created in-memory without having to write it to a temp file.
Granted, this is not so relevant for the maven plugin, but much more so when the Java classes are used as a library. Since the required changes are very small, I still think this would be a viable improvement.

Cannot import SCSS file

Hi,
I am using this plugin(thanks for creating this), though I am having issues with scss file import in some other scss file.

for example: one file is under /etc/designs/projects/project/base/css/myfile.scss

Now I want to import the above scss file in other scss file which is under /apps/some_heirarchy
Although both are under /jcr_root and that's the include path I have given in pom.xml as well.

Somehow, I am not able to import the scss file, below is my pom.xml

*Error: * Error: File to import not found or unreadable: demo.scss.

<plugin>
   <groupId>com.github.warmuuh</groupId>
   <artifactId>libsass-maven-plugin</artifactId>
   <version>0.2.8-libsass_3.4.4</version>
   <executions>
      <execution>
         <phase>generate-resources</phase>
         <goals>
            <goal>compile</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <inputPath>${basedir}/src/main/content/jcr_root/</inputPath>
      <outputPath>${basedir}/src/main/content/jcr_root/</outputPath>
   </configuration>
</plugin>

I have changed few names of folders above just for privacy concerns, but that's the case here.

Am I using the correct syntax, or it has to do something with the configuration, appreciate any help.

Thanks

cc: @warmuuh

Allow multiple paths to be specified for <inputPath>

Was wondering if it would be possible to specify multiple inputPath(s) for an execution the same way we can specify multiple includePaths (";" delimited). We currently have common sass files for a project in one path and project specific files in another path. Right now we have to perform two separate executions to generate the sass for the project.

If it's an easy thing to do, it might be a nice addition to be able to have the plugin iterate over multiple separate inputPaths.

Thanks!

outputPath doesn't work with "compressed" style

When the property "outputStyle" is setted to "compressed", "outputPath" property seems to be ignored and the result css file is generated to a folder named "compressed" in the root of the project.

edit: Ok my bad, it's working ;)

Css in Comments is Validated

Example: Somewhere in your css you have a line like this:

... /* background-image: url(TODO: insert background once PNG is ready) */ ...

=> Output of plugin: "Error: Invalid CSS after '...url("
Although the code is within a css comment (/* ... */)

Rasberry PI / ARM: Failed with "API incompatibility"

I got an error on a armv7l architecture.
Any tips?

Thanks in advance :-)

[ERROR] Failed to execute goal com.github.warmuuh:libsass-maven-plugin:0.2.6-libsass_3.4.0:compile (default) on project ui-bundle: Execution default of goal com.github.warmuuh:libsass-maven-plugin:0.2.6-libsass_3.4.0:compile failed: An API incompatibility was encountered while executing com.github.warmuuh:libsass-maven-plugin:0.2.6-libsass_3.4.0:compile: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.github.warmuuh:libsass-maven-plugin:0.2.6-libsass_3.4.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/var/lib/jenkins/.m2/repository/com/github/warmuuh/libsass-maven-plugin/0.2.6-libsass_3.4.0/libsass-maven-plugin-0.2.6-libsass_3.4.0.jar
[ERROR] urls[1] = file:/var/lib/jenkins/.m2/repository/io/bit3/jsass/5.4.0/jsass-5.4.0.jar
[ERROR] urls[2] = file:/var/lib/jenkins/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[3] = file:/var/lib/jenkins/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar
[ERROR] urls[4] = file:/var/lib/jenkins/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[5] = file:/var/lib/jenkins/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
[ERROR] urls[6] = file:/var/lib/jenkins/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar
[ERROR] urls[7] = file:/var/lib/jenkins/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar
[ERROR] urls[8] = file:/var/lib/jenkins/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[9] = file:/var/lib/jenkins/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[10] = file:/var/lib/jenkins/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.0.0.M5/org.eclipse.sisu.inject-0.0.0.M5.jar
[ERROR] urls[11] = file:/var/lib/jenkins/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar

Is this plugin threadsafe?

Currently if you attempt a parallel build with projects that use this plugin you get a warning:

$ mvn -T1C install
[..snipped..]
[WARNING] *****************************************************************
[WARNING] * Your build is requesting parallel execution, but project      *
[WARNING] * contains the following plugin(s) that have goals not marked   *
[WARNING] * as @threadSafe to support parallel building.                  *
[WARNING] * While this /may/ work fine, please look for plugin updates    *
[WARNING] * and/or request plugins be made thread-safe.                   *
[WARNING] * If reporting an issue, report it against the plugin in        *
[WARNING] * question, not against maven-core                              *
[WARNING] *****************************************************************
[WARNING] The following plugins are not marked @threadSafe in Sakai Library:
[WARNING] com.github.warmuuh:libsass-maven-plugin:0.2.6-libsass_3.4.0
[WARNING] Enable debug to see more precisely which goals are not marked @threadSafe.
[WARNING] *****************************************************************

Is the plugin threadsafe and just not marked as such, or are there problems running this plugin this way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.