2013-08-02 35 views
3

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

的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 
+0

尝试不使用'mavenLocal()',并抛出'--refresh-dependencies'只是为了确保。 –

+0

我删除了mavenLocal()并尝试刷新,并没有帮助,因为我没有这个任务。 – zmanc

回答

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

这个指南针可以用于多个文件夹吗? http://stackoverflow.com/q/33285167/2072569(也许你知道这是50代表) – Roel

1

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

+0

我在家里有这个问题,现在在工作。我的gradle安装有可能有问题吗?我为最初的帖子添加了更多信息。我看到它确实下载了jruby,但它表明它无法解析依赖关系。 – zmanc

+0

很难说。最好的机会是检查日志。 –

+0

解析构建脚本类路径时实际上并不失败;当'installCompass'任务试图解析'compass'配置时失败。也许你还没有正确配置'compass'插件? (我不熟悉那个插件。) –