2015-09-01 111 views
1

我想用下面的Gradle配置在項目上運行Gradle;運行Gradle時出錯

的build.gradle

apply plugin: 'scala' 
apply plugin: 'java' 
apply plugin: 'eclipse' 

task resolveDeps(type: Copy) { 
    into('lib') 
    from configurations.default 
    from configurations.default.allArtifacts.file 
} 

/* 
* Seems like we need this here and in the sub-projects section for testng to resolve. 
* (ralam Oct 4, 2009) 
*/ 
repositories { 
    mavenCentral() 
    add(new org.apache.ivy.plugins.resolver.ChainResolver()) { 
     name = 'remote' 
     returnFirst = true 
     add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      name = "googlecode" 
      addArtifactPattern "http://red5.googlecode.com/svn/repository/[artifact](-[revision]).[ext]" 
      addArtifactPattern "http://red5.googlecode.com/svn/repository/[organisation]/[artifact](-[revision]).[ext]" 
     } 
      add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      name = "blindside-repos" 
      addArtifactPattern "http://blindside.googlecode.com/svn/repository/[artifact](-[revision]).[ext]" 
      addArtifactPattern "http://blindside.googlecode.com/svn/repository/[organisation]/[artifact](-[revision]).[ext]" 
     }    
    add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      name = "maven2-central" 
      m2compatible = true 
      addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact](-[revision]).[ext]" 
      addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[artifact]/[revision]/[artifact](-[revision]).[ext]" 
     } 
    add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      name = "testng_ibiblio_maven2" 
      m2compatible = true 
      addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact](-[revision])-jdk15.[ext]" 
      addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[artifact]/[revision]/[artifact](-[revision])-jdk15.[ext]" 
     } 
     add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      name = "netty-dependency" 
      m2compatible = true 
      addArtifactPattern "http://repository.jboss.org/nexus/content/groups/public-jboss/[organisation]/[module]/[revision]/[artifact](-[revision]).[ext]" 
      addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[artifact]/[revision]/[artifact](-[revision]).[ext]" 
    } 
     add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      name = "spring-bundles" 
      m2compatible = true 
      addArtifactPattern "http://repository.springsource.com/maven/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
      addArtifactPattern "http://repository.springsource.com/maven/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
     }  
     add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      name = "Red5" 
      m2compatible = true 
      addArtifactPattern "http://red5.googlecode.com/svn/repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
      addArtifactPattern "http://red5.googlecode.com/svn/repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
     } 
    mavenRepo name: "sonatype-snapshot", urls: "http://oss.sonatype.org/content/repositories/snapshots" 
    mavenRepo name: "sonatype-releases", urls: "http://oss.sonatype.org/content/repositories/releases" 
    } 
} 

/**** 
* NOTES 
* 1. You cannot use provideCompile here as gradle will complain. But you can use it in the sub-projects. 
*/ 
dependencies { 
    // Servlet 
    compile 'javax.servlet:servlet-api:[email protected]' 

    // Mina 
    compile 'org.apache.mina:mina-core:[email protected]' 
    compile 'org.apache.mina:mina-integration-beans:[email protected]' 
    compile 'org.apache.mina:mina-integration-jmx:[email protected]' 

    // Spring 
    compile 'org.springframework:spring-web:[email protected]' 
    compile 'org.springframework:spring-beans:[email protected]' 
    compile 'org.springframework:spring-context:[email protected]' 
    compile 'org.springframework:spring-core:[email protected]' 

    // Red5 
    compile 'org/red5:red5-server:[email protected]' 
    compile 'org.red5:red5-server-common:[email protected]' 
    compile 'org.red5:red5-io:[email protected]' 

    // Logging 
    compile 'ch.qos.logback:logback-core:[email protected]' 
    compile 'ch.qos.logback:logback-classic:[email protected]' 
    compile 'org.slf4j:log4j-over-slf4j:[email protected]' 
    compile 'org.slf4j:jcl-over-slf4j:[email protected]' 
    compile 'org.slf4j:jul-to-slf4j:[email protected]' 
    compile 'org.slf4j:slf4j-api:[email protected]' 

    // Needed for the JVM shutdown hook but needs to be put into red5/lib dir. 
    // Otherwise we get exception on aop utils class not found. 
    compile 'org.springframework:spring-aop:[email protected]' 
    compile 'aopalliance:aopalliance:[email protected]' 

    // Testing 
// compile 'org.testng:testng:[email protected]' 
    compile 'org.easymock:easymock:[email protected]' 

    compile project(':common') 
    compile 'commons-fileupload:commons-fileupload:[email protected]' 
    compile 'commons-io:commons-io:[email protected]' 

    // Libraries needed to run the scala tools 
    scalaTools 'org.scala-lang:scala-compiler:2.9.2' 
    scalaTools 'org.scala-lang:scala-library:2.9.2' 

    // Libraries needed for scala api 
    compile 'org.scala-lang:scala-library:2.9.2' 

    compile 'net.lag:configgy:[email protected]' 

    //redis 
    compile 'redis.clients:jedis:2.0.0' 
    compile 'commons-pool:commons-pool:1.5.6' 
} 

test { 
    useTestNG() 
} 

subprojects { 
    apply plugin: 'java' 
    apply plugin: 'eclipse' 

    repositories { 
    mavenCentral() 
     add(new org.apache.ivy.plugins.resolver.ChainResolver()) { 
      name = 'remote' 
      returnFirst = true 
      add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       name = "googlecode" 
       addArtifactPattern "http://red5.googlecode.com/svn/repository/[artifact](-[revision]).[ext]" 
       addArtifactPattern "http://red5.googlecode.com/svn/repository/[organisation]/[artifact](-[revision]).[ext]" 
      } 
       add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       name = "blindside-repos" 
       addArtifactPattern "http://blindside.googlecode.com/svn/repository/[artifact](-[revision]).[ext]" 
       addArtifactPattern "http://blindside.googlecode.com/svn/repository/[organisation]/[artifact](-[revision]).[ext]" 
      }    
     add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       name = "maven2-central" 
       m2compatible = true 
       addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact](-[revision]).[ext]" 
       addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[artifact]/[revision]/[artifact](-[revision]).[ext]" 
      } 
     add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       name = "testng_ibiblio_maven2" 
       m2compatible = true 
       addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact](-[revision])-jdk15.[ext]" 
       addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[artifact]/[revision]/[artifact](-[revision])-jdk15.[ext]" 
      } 
      add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       name = "netty-dependency" 
       m2compatible = true 
       addArtifactPattern "http://repository.jboss.org/nexus/content/groups/public-jboss/[organisation]/[module]/[revision]/[artifact](-[revision]).[ext]" 
       addArtifactPattern "http://repo1.maven.org/maven2/[organisation]/[artifact]/[revision]/[artifact](-[revision]).[ext]" 
     } 
      add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       name = "spring-bundles" 
       m2compatible = true 
       addArtifactPattern "http://repository.springsource.com/maven/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
       addArtifactPattern "http://repository.springsource.com/maven/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" 
      }   
     } 
     mavenRepo name: "sonatype-snapshot", urls: "http://oss.sonatype.org/content/repositories/snapshots" 
     mavenRepo name: "sonatype-releases", urls: "http://oss.sonatype.org/content/repositories/releases" 
    } 

    group = 'org.bigbluebutton' 
    version = '0.9.0' 
    manifest.mainAttributes(provider: 'bigbluebutton') 
} 

Settings.gradle

include 'applet', 'app', 'common' 

每次我在終端運行gradle這個它提出了以下錯誤

FAILURE: Build failed with an exception. 

    * Where: 
    Build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle' line: 17 

    * What went wrong: 
    Could not compile build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle'. 
    > startup failed: 
     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 17: unable to resolve class org.apache.ivy.plugins.resolver.ChainResolver 
     @ line 17, column 9. 
       add(new org.apache.ivy.plugins.resolver.ChainResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 20: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 20, column 13. 
        add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
        ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 25: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 25, column 10. 
        add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 30: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 30, column 9. 
      add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 36: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 36, column 9. 
      add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 42: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 42, column 7. 
       add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 48: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 48, column 7. 
       add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 54: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 54, column 7. 
       add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
      ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 134: unable to resolve class org.apache.ivy.plugins.resolver.ChainResolver 
     @ line 134, column 10. 
       add(new org.apache.ivy.plugins.resolver.ChainResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 137: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 137, column 14. 
        add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
        ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 142: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 142, column 11. 
         add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 147: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 147, column 10. 
       add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 153: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 153, column 10. 
       add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 159: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 159, column 8. 
        add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     build file '/Users/Umair/Desktop/projects/conference_platform/phase 2/ss_code/bigbluebutton-master/deskshare/build.gradle': 165: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
     @ line 165, column 8. 
        add(new org.apache.ivy.plugins.resolver.URLResolver()) { 
       ^

     15 errors 


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

我相信這些錯誤有東西用常春藤做,但不是很確定。

順便說一句 - 我在Mac OSX Yosemite上。

在此先感謝。

+0

嗨@TezroSolutions我也試圖將BigBlueButton集成到我的Android應用程序中....可以請你建議我使用Android Studio的示例代碼鏈接。 –

回答

2

在世界的哪個地方你找到這個add的東西來定義你的知識庫?

你爲什麼不這樣做gradle documentation says

ivy { 
    url "http://red5.googlecode.com/svn/repository" 
    layout "pattern", { 
     artifact "[artifact](-[revision]).[ext]" 
     artifact "[organisation]/[artifact](-[revision]).[ext]" 
    } 
} 

我認爲你必須重新修整你的整個存儲庫定義。因爲你已經有了maven中心(已經包含在mavenCentral()中)。

仔細查看Gradle文檔應該如何定義存儲庫。你得到的大部分東西都可以簡化爲非常簡單的Maven遠程存儲庫定義,就像你爲兩個sonatype存儲庫所做的那樣。

+0

感謝您的回覆@nitram。我正在使用這個社區項目https://github.com/bigbluebutton/bigbluebutton/tree/master/deskshare –

+0

我沒有自己寫Gradle配置。 –

+0

@TezroSolutions可能是這樣的。這仍然是錯誤的。也許它是爲一些古代版本的Gradle寫的? – Nitram

0

我剛剛對最近開始維護的舊舊項目以及沒有時間升級Gradle文件的舊項目發生同樣的問題。我在Google上搜索錯誤時發現了這個問題,所以我想我會分享我的答案。

基本上,我的案例的問題是遺留項目使用過時版本的Gradle,而我自己的$PATH上的Gradle版本被設置爲更高版本。我可以通過降級在$GRADLE_HOME變量中的我的~/.bash_profile中指定的Gradle版本並再次獲取文件來修復問題。