Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File to import not found or unreadable: bootstrap-compass (issue only on Windows) #2005

Open
guofengzh opened this issue Sep 27, 2014 · 12 comments

Comments

@guofengzh
Copy link

I following the steps to create a jar for a Sass project:

  1. download jruby-complete-1.7.16.jar, rename it to jruby-complete.jar for simplicity.
  2. java -jar jruby-complete.jar -S gem install -i ./compass compass --no-rdoc --no-ri
  3. java -jar jruby-complete.jar -S gem install -i ./compass bootstrap-sass --no-rdoc --no-ri
  4. jar cf compass.jar -C compass . (compress the downloaded artifacts into a single jar

then I run the following command to create a Sass project:

java -cp jruby-complete.jar;compass.jar org.jruby.Main -S compass create my-new-project -r bootstrap-sass --using bootstrap

I got the following error:

    error my-new-project/sass/styles.scss (Line 1: File to import not found or unreadable: bootstrap-compass.
Load paths:
  Compass::SpriteImporter
  C:/projects/f5/jruby/my-new-project/sass
  C:/projects/f5/jruby/compass.jar!/gems/compass-core-1.0.1/stylesheets
  C:/projects/f5/jruby/compass.jar!/gems/bootstrap-sass-3.2.0.2/assets/stylesheets
  C:/projects/f5/jruby/compass.jar!/gems/bootstrap-sass-3.2.0.2/assets/stylesheets)
Compilation failed in 1 files.

I checked that _bootstrap-compass.scss existed in compass.jar\gems\bootstrap-sass-3.2.0.2\assets\stylesheets

Runing

java -cp jruby-complete.jar;compass.jar org.jruby.Main -S compass compile -c config.rb

got the same error output.

jdk1.8.0_11 (64bit)
jruby-complete-1.6.8.jar
Windows 8.1 (64 bit)

The above operations works well on Ubuntu (12.04).

This also occurred with jruby 1.7.13/14/15.

@guofengzh
Copy link
Author

sorry for typo.

The jruby version listed on the bottom part about the environment should be jruby-complete-1.7.16.jar.

@mprins
Copy link
Contributor

mprins commented Jun 15, 2015

I'm seeing this happen with up-to-date versions of

  • JRuby 1.7.20
  • Compass 1.0.3
  • Sass 3.4.14

using the sass-maven-plugin on windows. (GeoDienstenCentrum/sass-maven-plugin#41)

It can be worked around by downgrading JRuby to 1.7.10 as is demonstrated in this sample project: https://github.com/mprins/maven-compass-example

I've had a cursory look at the changes from 1.7.10...1.7.11
and see there's quite some changes in core/src/main/java/org/jruby/RubyDir.java and directory handling in zip/jar files. Maybe this was introduced in b9f60e0 ?

@mprins
Copy link
Contributor

mprins commented Jun 16, 2015

FWIW it also happens on 9.0.0.0.rc1

error/stack trace showing on AppVeyor: https://ci.appveyor.com/project/mprins/maven-compass-example/build/35%20(jruby-upgrade)

@mkristian
Copy link
Member

Caused by: org.jruby.exceptions.RaiseException: (ENOENT) No such file or directory - uri:classloader:\gems\compass-1.0.3\lib\compass\sprite_importer.rb\../sprite_importer/content.erb 
    at org.jruby.RubyIO.read(org/jruby/RubyIO.java:3592) 
    at RUBY.<class:SpriteImporter>(uri:classloader:/gems/compass-1.0.3/lib/compass/sprite_importer.rb:11) 

this looks like an issue with those slashes

@mprins
Copy link
Contributor

mprins commented Jun 18, 2015

yeah, compass has a hardcoded slash:

TEMPLATE_FOLDER       = File.join(File.expand_path('../', __FILE__), 'sprite_importer')

I guess that should be using

File.expand_path('..', __FILE__)

@mkristian
Copy link
Member

if the LoadService gets a string like uri:classloader:\gems\compass-1.0.3\lib\compass\sprite_importer.rb\../sprite_importer/content.erb it can fix the slashes. I can prepare the fix BUT can not test on windows ATM

ruby itself uses / for its paths internally but jruby needs to switch to OS dependent path representation. here it looks like things got mangled somewhere. the File.expand_path looks OK for me.

@mkristian
Copy link
Member

@mprins I uploaded jruby-1.7,21-SNAPSHOT to https://oss.sonatype.org/content/repositories/snapshots/org/jruby/

if you have a chance to test this on windows it would be great.

@mprins
Copy link
Contributor

mprins commented Jun 19, 2015

that error message above

Caused by: org.jruby.exceptions.RaiseException: (ENOENT) No such file or directory - uri:classloader:\gems\compass-1.0.3\lib\compass\sprite_importer.rb\../sprite_importer/content.erb 
    at org.jruby.RubyIO.read(org/jruby/RubyIO.java:3592) 
    at RUBY.<class:SpriteImporter>(uri:classloader:/gems/compass-1.0.3/lib/compass/sprite_importer.rb:11) 

this looks like an issue with those slashes

Is actually from the 9.0.0.0-RC1 release

I created a branch in my sample project with the jruby-1.7.21-SNAPSHOT but that still fails:

[ERROR] Compilation of template C:/projects/maven-compass-example/src/main/scss/compiled.scss failed: File to import not found or unreadable: compass.
Load paths:
  C:/Users/appveyor/.m2/repository/nl/geodienstencentrum/maven/sass-maven-plugin/2.6/sass-maven-plugin-2.6.jar!/gems/compass-core-1.0.3/stylesheets
  Compass::SpriteImporter
  C:/projects/maven-compass-example/src/main/scss 

@mkristian
Copy link
Member

ah - ok. my fault. jruby-9k uses uri:classloader: pseudo protocol whenever you use jruby-complete or ScriptingContainer or ... so I will merge the fix to master. on jruby-1.7.x I do not see the problem from the stacktraces alone :(

@mkristian
Copy link
Member

@mprins I just deployed the jruby-9.0.0.0-SNAPSHOT on the same sonatype repo. maybe you find some time to give it a run.

@mkristian mkristian reopened this Jun 19, 2015
@mprins
Copy link
Contributor

mprins commented Jun 19, 2015

Using the 9000 snapshot resolves this (on both java 7 and java 8)

see: https://ci.appveyor.com/project/mprins/maven-compass-example/build/42%20(jruby-9000-SNAPSHOT)

@mkristian
Copy link
Member

cool. the jruby-1.7.x could be related to

`````` C:/Users/appveyor/.m2/repository/nl/geodienstencentrum/maven/sass-maven-plugin/2.6/sass-maven-plugin-2.6.jar!/gems/compass-core-1.0.3/stylesheets```

not getting translated into a correct
jar:file:C:/Users/appveyor/.m2/repository/nl/geodienstencentrum/maven/sass-maven-plugin/2.6/sass-maven-plugin-2.6.jar!/gems/compass-core-1.0.3/stylesheet
url - I mean the slashes here could be wrong for windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants