首页 > 代码库 > 亲自动手从源码 构建 Groovy 2.3.8 发布包
亲自动手从源码 构建 Groovy 2.3.8 发布包
今天为了学习 如何使用 Groovy 写 Groovy 的测试代码, 所以到 http://groovy.codehaus.org/Download 下载了 Groovy 2.3.8 的源代码包.
Groovy 是采用 Gradle 作为 构建工具的. 先看我本地的 Gradle 的相关环境:
>gradle -v ------------------------------------------------------------ Gradle 2.2 ------------------------------------------------------------ Build time: 2014-11-10 13:31:44 UTC Build number: none Revision: aab8521f1fd9a3484cac18123a72bcfdeb7006ec Groovy: 2.3.6 Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013 JVM: 1.8.0_25 (Oracle Corporation 25.25-b02) OS: Windows 7 6.1 amd64
然后我在加压缩之后的源码根目录下输入 gradle tasks ,
gradle 开始从 jcenter 下载需要的 jar 包,
然后开始编译,
最后出现这个错误:
Detected development environment Deployment environment set to Bintray FAILURE: Build failed with an exception. * Where: Script 'H:\TDDownload\groovy-src-2.3.8\groovy-2.3.8\gradle\pomconfigurer.gradle' line: 10 * What went wrong: A problem occurred evaluating script. > Could not find property 'groovy' on configuration container. * 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: 5 mins 7.403 secs
我接着用 gradle tasks --info 命令再跑一遍, 还是出现下面的错误:
Detected development environment Deployment environment set to Bintray FAILURE: Build failed with an exception. * Where: Script 'H:\TDDownload\groovy-src-2.3.8\groovy-2.3.8\gradle\pomconfigurer.gradle' line: 10 * What went wrong: A problem occurred evaluating script. > Could not find property 'groovy' on configuration container. * Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. BUILD FAILED Total time: 7.911 secs Stopped 0 compiler daemon(s). Received result DaemonCommandResult[type=CommandFailure, value=http://www.mamicode.com/org.gradle.launcher.exec.ReportedException: org.gradle.internal.exceptions.LocationAwareException>
怎样绕过这个错误呢? 难道是我的 Gradle 的版本问题?
于是我打开文件 H:\TDDownload\groovy-src-2.3.8\groovy-2.3.8\README.adoc ,
发现里面说到:
To build everything using Gradle (the command below will download Gradle automatically, you do not need to download it first). ./gradlew clean dist
于是我就打开 命令行 窗口 到 源码目录下, 键入: gradlew clean dist我发现这个命令会首先下载一个 gradle-1.12 -all 到本地
C:\Users\chenjo\.gradle\wrapper\dists\gradle-1.12-all
然后加压缩, 然后在以该版本下载 jar 包 以及进行 编译, 汇总.... 虽然中间有一些警告, 或是下载 jar 包时网络受阻, 我就中断命令重新执行几次, 最后 build 成功.
Applying Javadoc fix tool (see http://www.kb.cert.org/vuls/id/225657) into H:\TDDownload\groovy-src-2.3.8\groovy-2.3.8\target\alljavadoc :doc :distDoc :distSrc :groovydoc :javadoc Applying Javadoc fix tool (see http://www.kb.cert.org/vuls/id/225657) into H:\TDDownload\groovy-src-2.3.8\groovy-2.3.8\target\docs\javadoc :syncDoc :dist BUILD SUCCESSFUL Total time: 18 mins 2.66 secs然后我看到 生成的 target 文件夹 居然有 500 多 M 字节.
在 项目目录\target\distributions\ 下, 有如下生成的发布文件:
groovy-binary-2.3.8.zip
groovy-docs-2.3.8.zip
groovy-sdk-2.3.8.zip
groovy-src-2.3.8.zip
亲自动手从源码 构建 Groovy 2.3.8 发布包
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。