简单的 Gradle 构建运行 Compass 失败

3

我有一个非常简单的gradle项目。 我只是尝试运行compass。 但是当我尝试运行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

尝试不使用 mavenLocal(),并加入 --refresh-dependencies 以确保。 - Peter Niederwieser
我移除了mavenLocal()并尝试刷新,但是没有帮助,因为我没有那个任务。 - zmanc
2个回答

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')
}

这个指南针能用于多个文件夹吗?https://dev59.com/wlwX5IYBdhLWcg3w4So3(也许你知道这个问题,可以获得50声望) - Roel

1

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


我在家里和现在在工作中都遇到了这个问题。我的gradle安装可能有问题吗?我还在初始帖子中添加了更多信息。我看到它确实下载了jruby,但它指出无法解决依赖关系。 - zmanc
很难说。最好的机会是检查日志。 - Peter Niederwieser
实际上,当解析构建脚本类路径时,并没有出现故障;而是在installCompass任务尝试解析compass配置时出现了故障。也许您没有正确配置compass插件?(我不熟悉该插件。) - Peter Niederwieser
这行代码不是表示它使用jruby吗?我也可以检查我的compass配置。找不到org.jruby:jruby-complete:1.7.3。 - zmanc
上面的jruby-complete行是针对不同的配置,可能是不必要的。您应该检查compass插件配置。 - Peter Niederwieser
我无法在插件中找到任何内容。不确定要查找什么。 - zmanc

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接