使用 Gradle 编译 Ceylon 示例时出错
Error compiling Ceylon example with Gradle
Ceylon 1.3.1 刚刚发布,新项目之一是更好地与Java projects/libraries 集成。决定试一试其中一个样本 (https://github.com/DiegoCoronel/ceylon-spring-boot) alongside the ceylon-gradle plugin (https://github.com/renatoathaydes/ceylon-gradle-plugin)。
据我所知,将这个项目变成一个多项目 Gradle 构建就是添加两个具有以下配置的文件。
settings.gradle
include 'gateway'
include 'discovery'
include 'foo'
include 'bar'
include 'foobar'
build.gradle
plugins {
id 'com.athaydes.ceylon' version '1.3.0' apply false
}
subprojects { subprj ->
subprj.apply plugin: 'com.athaydes.ceylon'
repositories {
mavenCentral()
}
ceylon {
module = subprj.name
}
}
不幸的是,构建任何模块都会导致错误,例如
$ gradle :gateway:compileCeylon
:gateway:resolveCeylonDependencies
:gateway:createDependenciesPoms
:gateway:createMavenRepo
:gateway:generateOverridesFile
:gateway:createModuleDescriptors
:gateway:importJars
:gateway:compileCeylon
source/gateway/module.ceylon:3: error: Pre-resolving of module failed: Could not find module: antlr/2.7.7
import ceylon.interop.java "1.3.0";
^
ceylon compile: There was 1 error
:gateway:compileCeylon FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gateway:compileCeylon'.
> Ceylon process exited with code 1. See output for details.
这发生在使用 Gradle 3.2
------------------------------------------------------------
Gradle 3.2
------------------------------------------------------------
Build time: 2016-11-14 12:32:59 UTC
Revision: 5d11ba7bc3d79aa2fbe7c30a022766f4532bbe0f
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_112 (Oracle Corporation 25.112-b16)
OS: Mac OS X 10.10.5 x86_64
尝试按照插件文档中的说明在 ceylon
配置上设置其他属性,例如
ceylon {
flatClasspath = false
importJars = true
forceImports = true
}
但是错误仍然存在。任何关于我可能遗漏的指示都将不胜感激。
这是因为 ceylon gradle 插件 does not support yet 新功能 --fully-export-maven-dependencies ...我现在创建了这个问题 ;),所以为了让你的项目工作可能需要使用以下选项更改 each subproject/.ceylon/config:
[compiler]
source=source
resource=resource
[defaults]
encoding=UTF-8
overrides=build/overrides.xml
flatclasspath=true
fullyexportmavendependencies=false
它将禁用新的 Ceylon 功能并使用 Ceylon gradle 插件功能和生成的 overrides.xml 文件
Ceylon 1.3.1 刚刚发布,新项目之一是更好地与Java projects/libraries 集成。决定试一试其中一个样本 (https://github.com/DiegoCoronel/ceylon-spring-boot) alongside the ceylon-gradle plugin (https://github.com/renatoathaydes/ceylon-gradle-plugin)。
据我所知,将这个项目变成一个多项目 Gradle 构建就是添加两个具有以下配置的文件。
settings.gradle
include 'gateway'
include 'discovery'
include 'foo'
include 'bar'
include 'foobar'
build.gradle
plugins {
id 'com.athaydes.ceylon' version '1.3.0' apply false
}
subprojects { subprj ->
subprj.apply plugin: 'com.athaydes.ceylon'
repositories {
mavenCentral()
}
ceylon {
module = subprj.name
}
}
不幸的是,构建任何模块都会导致错误,例如
$ gradle :gateway:compileCeylon
:gateway:resolveCeylonDependencies
:gateway:createDependenciesPoms
:gateway:createMavenRepo
:gateway:generateOverridesFile
:gateway:createModuleDescriptors
:gateway:importJars
:gateway:compileCeylon
source/gateway/module.ceylon:3: error: Pre-resolving of module failed: Could not find module: antlr/2.7.7
import ceylon.interop.java "1.3.0";
^
ceylon compile: There was 1 error
:gateway:compileCeylon FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gateway:compileCeylon'.
> Ceylon process exited with code 1. See output for details.
这发生在使用 Gradle 3.2
------------------------------------------------------------
Gradle 3.2
------------------------------------------------------------
Build time: 2016-11-14 12:32:59 UTC
Revision: 5d11ba7bc3d79aa2fbe7c30a022766f4532bbe0f
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_112 (Oracle Corporation 25.112-b16)
OS: Mac OS X 10.10.5 x86_64
尝试按照插件文档中的说明在 ceylon
配置上设置其他属性,例如
ceylon {
flatClasspath = false
importJars = true
forceImports = true
}
但是错误仍然存在。任何关于我可能遗漏的指示都将不胜感激。
这是因为 ceylon gradle 插件 does not support yet 新功能 --fully-export-maven-dependencies ...我现在创建了这个问题 ;),所以为了让你的项目工作可能需要使用以下选项更改 each subproject/.ceylon/config:
[compiler]
source=source
resource=resource
[defaults]
encoding=UTF-8
overrides=build/overrides.xml
flatclasspath=true
fullyexportmavendependencies=false
它将禁用新的 Ceylon 功能并使用 Ceylon gradle 插件功能和生成的 overrides.xml 文件