• kakfa源代码开发环境搭建过程中的错误处理


    在window上搭建kafka的源代码开发环境,主要参考如下的blog:

    http://www.bubuko.com/infodetail-695974.html    << Windows平台搭建Kafka源代码开发环境(Eclipse版本) >>

    http://stackoverflow.com/questions/25994163/could-not-resolve-all-dependencies-for-configuration-classpath

    但是在国内的网络环境限制, 下载依赖的jar包出现了各种问题,本文将介绍如何修改kafka源代码中的构建文件,避免这些问题:

    gradle下载:

    https://services.gradle.org/distributions/gradle-2.9-all.zip

    GRADLE_HOME

    gradlew eclipse
    gradle wrapper
    http://dl.bintray.com/content/netflixoss/external-gradle-plugins/


    D:源码kafka-0.8.2.1-src>gradle eclipse
    To honour the JVM settings for this build a new JVM will be forked. Please consi
    der using the daemon: http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html.
    FAILURE: Build failed with an exception.
    * What went wrong:
    A problem occurred configuring root project 'kafka-0.8.2.1-src'.
    > Could not resolve all dependencies for configuration ':classpath'.
       > Could not resolve nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0.
         Required by:
             org.apache.kafka:kafka-0.8.2.1-src:0.8.2.1
          > Could not GET 'https://repo1.maven.org/maven2/nl/javadude/gradle/plugins
    /license-gradle-plugin/0.10.0/license-gradle-plugin-0.10.0.pom'.
             > peer not authenticated
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.
    BUILD FAILED


    解决办法:
    修改build.gradle
    //buildscript {
    //  repositories {
    //    mavenCentral()
    //  }
    //  apply from: file('gradle/buildscript.gradle'), to: buildscript
    //}

    buildscript {
         repositories {
        jcenter {
    //        url "http://jcenter.bintray.com/"
            maven { url 'http://repo1.maven.org/maven2' }
        }
        apply from: file('gradle/buildscript.gradle'), to: buildscript
      }
    }


    修改
    //allprojects {
    //  apply plugin: 'idea'
    //  repositories {
    //    mavenCentral()
    //  }
    //}

    allprojects {
    repositories {
        jcenter {
            url "http://jcenter.bintray.com/"
        }
      }
    }
    ---------------------------
    D:源码kafka-0.8.2.1-src>gradle wrapper
    To honour the JVM settings for this build a new JVM will be forked. Please consi
    der using the daemon: http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html.
    FAILURE: Build failed with an exception.
    * Where:
    Script 'D:源码kafka-0.8.2.1-srcgradlelicense.gradle' line: 2
    * What went wrong:
    A problem occurred evaluating script.
    > Failed to apply plugin [id 'license']
       > Plugin with id 'license' not found.
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.
    BUILD FAILED
    意思是  [id 'license'] 没有被发现,修改buildscript,添加apply from: file('gradle/buildscript.gradle'), to: buildscript
    buildscript {
         repositories {
        jcenter {
    //        url "http://jcenter.bintray.com/"
            maven { url 'http://repo1.maven.org/maven2' }
        }
        apply from: file('gradle/buildscript.gradle'), to: buildscript
      }
    }
    然后执行 grade  wrapper  #BUILD SUCCESSFUL
    D:源码kafka-0.8.2.1-src>gradle wrapper
    To honour the JVM settings for this build a new JVM will be forked. Please cons
    der using the daemon: http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html
    Download http://repo1.maven.org/maven2/nl/javadude/gradle/plugins/license-gradl
    -plugin/0.10.0/license-gradle-plugin-0.10.0.pom
    Download http://repo1.maven.org/maven2/com/mycila/maven-license-plugin/maven-li
    ense-plugin/1.10.b1/maven-license-plugin-1.10.b1.pom
    Download http://repo1.maven.org/maven2/com/mycila/parent-pom/5/parent-pom-5.pom
    Download http://repo1.maven.org/maven2/com/mycila/xmltool/xmltool/3.3/xmltool-3
    3.pom
    Download http://repo1.maven.org/maven2/nl/javadude/gradle/plugins/license-gradl
    -plugin/0.10.0/license-gradle-plugin-0.10.0.jar
    Download http://repo1.maven.org/maven2/com/mycila/maven-license-plugin/maven-li
    ense-plugin/1.10.b1/maven-license-plugin-1.10.b1.jar
    Download http://repo1.maven.org/maven2/com/mycila/xmltool/xmltool/3.3/xmltool-3
    3.jar
    Building project 'core' with Scala version 2.10.4
    :wrapper
    BUILD SUCCESSFUL
    ---------------------------------------------------

    D:源码kafka-0.8.2.1-src>gradle eclipse

    卡在 下载 scalatest_2.10/1.9.1/scalatest_2.10-1.9.1-sources.jar 的过程中,死活下载不了,

    目前使用的是 http://jcenter.bintray.com/库,改成库 "http://repo1.maven.org/maven2/"  试一下,最后执行成功。

    Image

    vi build.gradle 

    修改如下配置:

    allprojects {
    repositories {
        jcenter {
    //        url "http://jcenter.bintray.com/"
            url "http://repo1.maven.org/maven2/"
        }
      }
    }
    scalatest_2.10-1.9.1.jar of core build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.     core          Unknown     Scala Version Problem

    --------------------------------------------------------------------

    D:源码kafka-0.8.2.1-src>gradle idea 

    失败,

    Image(1)

    解决办法,修改build.gradle

    需改如下内容,

    修改

    //allprojects {
    //  apply plugin: 'idea'
    //  repositories {
    //    mavenCentral()
    //  }

    //}

    为,并加上apply plugin: 'idea' ,

    allprojects {

    repositories {

        apply plugin: 'idea'  

        jcenter {
    //        url "http://jcenter.bintray.com/"
            url "http://repo1.maven.org/maven2/"
        }
      }

    }

    ------------------------------------------

    maven { url 'http://repo1.maven.org/maven2' }
    repositories {
        jcenter {
            url "http://jcenter.bintray.com/"
        }
    }
    repositories {
        maven  {
            url "http://repo1.maven.org/maven2"
        }

    }

  • 相关阅读:
    不加好友就能微信聊天?微信企业号实现了!
    上海9000辆出租车上铺设免费微信连WiFi
    利用excel数据透视表实现快速统计相关数据
    [荐]微信公众号营销推广系统,中小企业微信公众平台开发商佳选
    第六回 煤渣场对垒藏高人 小饭馆煮面论英雄[林大帅作品连载]
    第五回 菁菁岁月可堪一叙 琴瑟合奏难敌世情[林大帅作品连载]
    第四回:星夜急返桑梓地 浊泪再洒旧书院[林大帅作品连载]
    第三回:羁旅客忆碌碌旧事 暴雨天里依依惜别[林大帅作品连载]
    微信支付越来越国际化 支持外国护照绑卡
    机器学习中的数学(4)-线性判别分析(LDA), 主成分分析(PCA)
  • 原文地址:https://www.cnblogs.com/honeybee/p/5546259.html
Copyright © 2020-2023  润新知