robfletcher / gradle-compass

A SASS / Compass plugin for Gradle
Apache License 2.0
60 stars 38 forks source link

installing "breakpoint" gem (via installCompass) fails on vanilla Linux and Windows #17

Open akhikhl opened 10 years ago

akhikhl commented 10 years ago

Problem

Attempt to install "breakpoint" gem via installCompass task fails with error message "java not found" both on Linux and Windows.

Steps to reproduce problem

  1. Setup configuration/environment (see below).
  2. Create sample build.gradle (see below).
  3. Run "build installCompass".

    Program output

On Linux:

ahi@ahi-home ~/Projects/try-gradle-compass $ gradle installCompass
:installCompass
Successfully installed compass-0.12.2
Building native extensions.  This could take a while...
1 gem installed
ERROR:  Error installing breakpoint:

    ERROR: Failed to build gem native extension.

        java -jar /home/ahi/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.3/2273e4c2a2abdd4b25a21bc513bfc05cfba31f3b/jruby-complete-1.7.3.jar mkrf_conf.rb
/bin/sh: 1: java: not found

Gem files will remain installed in /home/ahi/.gradle/.jruby/gems/sass-3.3.0.rc.3 for inspection.
Results logged to /home/ahi/.gradle/.jruby/gems/sass-3.3.0.rc.3/ext/gem_make.out
:installCompass FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':installCompass'.
> Process 'command '/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 57.228 secs

very similar error message is observed on Windows.

Configuration/environment Linux:

  1. Freshly installed Linux Mint Petra 64-bit, 3.11.0-12-generic, all updates installed.
  2. java-7-oracle (JDK) update 51 installed from ppa:webupd8team/java
  3. JAVA_HOME is correctly set to an existing folder containing JDK
  4. JAVA_HOME does not point to symbolic link
  5. java -version works in bash without problems
  6. ruby is not installed (although it should not matter for jruby)
  7. gradle 1.10 installed via gvm-tool

    Configuration/environment Windows:

  8. Freshly installed Windows-7 64-bit, all updates installed.
  9. java-7-oracle (JDK) update 51 installed from oracle site
  10. JAVA_HOME is correctly set to an existing folder containing JDK
  11. JAVA_HOME does not point to symbolic link
  12. java -version works in git-bash without problems
  13. ruby is not installed (although it should not matter for jruby)
  14. gradle 1.10 installed via gvm-tool

    Sample build.gradle

apply plugin: 'compass'

buildscript {
  repositories {
    jcenter()
    maven { url 'http://dl.bintray.com/robfletcher/gradle-plugins' }
  }
  dependencies {
    classpath 'org.gradle.plugins:gradle-compass:1.0.9'
  }
}

apply plugin: 'maven'

repositories {
  jcenter()
}

compass {
  gemPath = new File(gradle.gradleUserHomeDir, ".jruby")
  gems = ["compass", "breakpoint"]
}
beckje01 commented 10 years ago

I had a working version and backed up my ~/.gradle/.jruby and let this run again I see that the old working version had the gem sass-3.3.0.rc.2 installed where it is now failing is on sass-3.3.0.rc.3

akhikhl commented 10 years ago

When "breakpoint" is commented out, error disappears. So, the problem seems to be specific to installing "breakpoint" gem under jruby.

robfletcher commented 10 years ago

I've just seen this with a non-Gradle Sass project (using Grunt). Looks to me like the problem is in the version of Compass that Breakpoint depends on being too rigid. Then when the plugin installs both compass and breakpoint gems it gets the latest of each which causes a version conflict.

I guess I need to read up on resolving conflicts with Ruby gems :-/

robfletcher commented 10 years ago

It looks like one of the gems is doing some kind of post-installation task that requires Java. The JRubyTask class overrides the PATH environment variable, though. I can fix that but then it complains that jrake is not found. I have no idea what needs that or why it thinks it should already be installed.

akhikhl commented 10 years ago

Rob, thank you for checking this. I tried fixing PATH as well, with the same result as you - jrake not found. Next logical step is to add Rake gem:

gems = ["rake", "compass", "breakpoint"]

then Breakpoint post-installation gets past "jrake not found". Now it hits the next error:

Installing listen >= 1.1.0, < 2.5

"java -jar /home/ahi/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.8/c72460fd292ac290953373c7d5a14a2d98b6dfa1/jruby-complete-1.7.8.jar" -rubygems /home/ahi/.gradle/.jruby/gems/rake-10.1.1/bin/rake RUBYARCHDIR=/home/ahi/.gradle/.jruby/gems/sass-3.3.0.rc.3/lib RUBYLIBDIR=/home/ahi/.gradle/.jruby/gems/sass-3.3.0.rc.3/lib
/bin/sh: 1: java -jar /home/ahi/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.8/c72460fd292ac290953373c7d5a14a2d98b6dfa1/jruby-complete-1.7.8.jar: not found

I guess, this has something to do with quote symbols around "java -jar ...". For example, when you copy the first line "java -jar ..." to the bash prompt and try to run it, it gives a message "No such file or directory". Probably, Breakpoint forms invalid command-line. I'll check whether there's a difference with this between Linux and Windows.

robfletcher commented 10 years ago

yes, I'm getting to exactly the same point. I managed to get past the jrake error by just upgrading to the latest JRuby – I didn't have to specify the rake gem explicitly.

By the way, I'm successfully recreating this on OSX.

akhikhl commented 10 years ago

That's good news. Do I get it right, you install jruby separately? I mean it would be great, if things "just work" with gradle and maven repos, without manually installed software.

robfletcher commented 10 years ago

No I just upgraded the version of JRuby that the plugin looks for.

On 14 February 2014 at 11:07:36, Andrey Hihlovskiy (notifications@github.com) wrote:

That's good news. Do I get it right, you install jruby separately? I mean it would be great, if things "just work" with gradle and maven repos, without manually installed software.


Reply to this email directly or view it on GitHub: https://github.com/robfletcher/gradle-compass/issues/17#issuecomment-35074703

robfletcher commented 10 years ago

Is this still happening with v2.0.1 of the plugin?