3

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

构建.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
4

2 回答 2

1

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

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')
}
于 2013-08-07T12:48:11.870 回答
1

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

于 2013-08-02T11:56:33.447 回答