Jasig/sass-maven-plugin

Passing relative paths to JRuby

snekse opened this issue · 3 comments

When I try running the sass-maven-plugin, JRuby complains with the following error.

org.jruby.exceptions.RaiseException: (LoadError) no such file to load`
 -- jar:file:C:/Users/johnsmith/.m2/repository/org/jasig/maven
/sass-maven-plugin/1.0.1-SNAPSHOT/sass-maven-plugin-1.0.1-SNAPSHOT.jar!/gems/sass-3.2.2/lib/sass/../sass

I'm not sure where the relative path for the gems is coming from. This is the value being passed to jruby.eval(sassScript):

require 'rubygems'
require 'sass/plugin'
Sass::Plugin.options.merge!(
    :always_update => true,
    :cache_location => 'C:/Users/johnsmith/Dev/workspace/mycostatic/src/main/webapp/sass_cache',
    :style => :compressed
)
Sass::Plugin.add_template_location('C:/Users/johnsmith/Dev/workspace/mycostatic/src/main/webapp/mycoweb/scss', 'C:/Users/johnsmith/Dev/workspace/mycostatic/src/main/webapp/mycoweb')
Sass::Plugin.update_stylesheets

I believe my pom config is pretty basic.

<plugin>
  <groupId>org.jasig.maven</groupId>
  <artifactId>sass-maven-plugin</artifactId>
  <version>1.0.1-SNAPSHOT</version>
  <configuration>
    <sassSourceDirectory>C:/Users/johnsmith/Dev/workspace/mycostatic/src/main/webapp/mycoweb</sassSourceDirectory>
    <baseOutputDirectory>C:/Users/johnsmith/Dev/workspace/mycostatic/src/main/webapp/mycoweb</baseOutputDirectory>
    <sassOptions>
<cache_location>'C:/Users/johnsmith/Dev/workspace/mycostatic/src/main/webapp/sass_cache'</cache_location>
<always_update>true</always_update>
<style>:compressed</style>
    </sassOptions>
  </configuration>
</plugin> 

There is an issue opened against JRuby regarding relative paths, but I'm not sure which project is really best positioned to address this problem.
jruby/jruby#235

I've created a basic app to illustrate what I'm trying to do.
https://github.com/snekse/sass-maven-plugin-test

Running mvn sass:update-stylesheets results in

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building sass-maven-plugin-test Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- sass-maven-plugin:1.0.1-SNAPSHOT:update-stylesheets (default-cli) @ sass-maven-plugin-test ---
[INFO] Queing SASS Template for compile: scss => gen-css
[INFO] Compiling SASS Templates
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.662s
[INFO] Finished at: Tue Nov 20 12:11:14 CST 2012
[INFO] Final Memory: 16M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
  org.jasig.maven:sass-maven-plugin:1.0.1-SNAPSHOT:update-stylesheets (default-cli) 
  on project sass-maven-plugin-test: 
  Failed to execute SASS ruby script:
[ERROR] require 'rubygems'
[ERROR] require 'sass/plugin'
[ERROR] Sass::Plugin.options.merge!(
[ERROR] :always_update => false,
[ERROR] :cache => false,
[ERROR] :cache_location => 'C:/Users/johnsmith/git/sass-maven-plugin-test/target/sass_cache',
[ERROR] :style => :compressed
[ERROR] )
[ERROR] Sass::Plugin.add_template_location(
  'C:/Users/johnsmith/git/sass-maven-plugin-test/src/main/webapp/scss', 
  'C:/Users/johnsmith/git/sass-maven-plugin-test/src/main/webapp/gen-css')
[ERROR] Sass::Plugin.update_stylesheets: org.jruby.embed.EvalFailedException: 
  (LoadError) no such file to load 
  -- jar:file:C:/Users/johnsmith/.m2/repository/org/jasig/maven/sass-maven-plugin/1.0.1-SNAPSHOT/sass-maven-plugin-1.0.1-SNAPSHOT.jar!/gems/sass-3.2.2/lib/sass/../sass
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I can't quite figure out what's telling JRuby to load Sass from the jar location. I'd like to fiddle with whatever is doing that to see if a non-relative location (sans ..) would resolve the problem.

Of course, if it's "not a problem on my machine", I'd like to get that figured out as well. I'm running Windows 7 64bit, Maven 3.0.4.

I run into the same issue when trying to use the "gem-in-jar" strategy with jRuby.

LoadError: no such file to load jar:file:C:/[my path]/ruby/compass/lib/zurb-foundation-3.2.0.jar!/gems/sass-3.2.2/lib/sass/../sass

The only way I've been able to resolve it is to forgo the "gem-in-jar" strategy entirely and have the full installed gem directories available on my classpath. This is less than desirable since it requires having all the gem's files uncompressed in our source control (1,000s of files).

If someone comes up with a fix, I'd love to hear it.

Hi,

Just spotted that this is a duplicate of #14, which I've created.

Currently, 1.0.0 release only works for us on Linux, and 1.0.1-SNAPSHOT doesn't work at all due to this bug, which I suspect may be a Sass Plugin or JRuby issue due to Wro4j also seeing the same issue