简单的gradle构建运行指南针失败

时间:2013-08-02 02:36:56

标签: jruby gradle compass-sass

我有一个非常简单的gradle项目。我只是想跑罗盘。但是,当我尝试运行gradle installCompass时,构建失败。我包含了我正在使用的构建脚本。我在项目中只有这个脚本和一个scss文件。

的build.gradle

apply plugin: 'compass'

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url 'http://dl.bintray.com/robfletcher/gradle-plugins' }
    }
    dependencies {
        classpath 'org.jruby:jruby-complete:1.7.3'
        classpath 'org.gradle.plugins:gradle-compass:1.0.7'
    }
}
compass {
    cssDir = file('public/styles')
    sassDir = file('scss')
}

我得到的错误

A problem occurred configuring root project 'GradleStyleGuide'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find org.jruby:jruby-complete:1.7.3..
     Required by:
         :GradleStyleGuide:unspecified

这是依赖性检查的结果

compass
\--- org.jruby:jruby-complete:1.7.3 FAILED

以下是从命令行运行构建时发生的情况。

Gradle 1.6
------------------------------------------------------------

Gradle build time: Tuesday, May 7, 2013 9:12:14 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.7.0_17 (Oracle Corporation 23.7-b01)
OS: Windows 7 6.1 amd64

C:\Users\me>cd \code\GradleStyleGuide

C:\code\GradleStyleGuide>gradle installCompass
Download http://repo1.maven.org/maven2/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.pom
Download http://repo1.maven.org/maven2/org/jruby/shared/1.7.3/shared-1.7.3.pom
Download http://dl.bintray.com/robfletcher/gradle-plugins/org/gradle/plugins/gradle-compass/1.0.7/gradle-compass-1.0.7.pom
Download http://repo1.maven.org/maven2/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar
Download http://dl.bintray.com/robfletcher/gradle-plugins/org/gradle/plugins/gradle-compass/1.0.7/gradle-compass-1.0.7.jar
:installCompass FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':installCompass'.
> Could not resolve all dependencies for configuration ':compass'.
   > Could not find org.jruby:jruby-complete:1.7.3.
     Required by:
         :GradleStyleGuide:unspecified

* 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: 10.014 secs

2 个答案:

答案 0 :(得分:1)

我可以很好地解决jruby-complete(使用您的构建脚本)。可能是问题与您的环境有关(例如,没有为Gradle配置代理设置)。我建议使用--info运行并检查日志输出。

答案 1 :(得分:1)

在添加包装器任务和mavenCentral存储库之后,在buildscript之外我能够使其工作。

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

repositories {
    mavenCentral()
}

apply plugin: 'compass'

task wrapper(type: Wrapper) {
    gradleVersion = "1.6"
}

compass {
    cssDir = file('public/styles')
    sassDir = file('sass')
}