2

Ceylon 1.3.1 has just been released, one of the new items is better integration with Java projects/libraries. Decided to take one of the samples for a spin (https://github.com/DiegoCoronel/ceylon-spring-boot) alongside the ceylon-gradle plugin (https://github.com/renatoathaydes/ceylon-gradle-plugin).

As far as I can tell, turning this project into a multi-project Gradle build is a matter of adding two files with the following configuration.

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
    }
}

Unfortunately building any of the modules results in errors, such as

$ 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.

This happens using 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

Tried setting additional properties on the ceylon configuration as explained in the plugin's documentation, such as

ceylon {
    flatClasspath = false
    importJars = true
    forceImports = true
}

However the error persists. Any pointers on what I may be missing would be greatly appreciated.

Andres Almiray
  • 3,236
  • 18
  • 28
  • Hi! Sorry, I haven't had time yet to update the Ceylon Plugin to use Ceylon 1.3.1! Will get this fixed soon! – Renato Nov 23 '16 at 14:24

1 Answers1

3

This is because ceylon gradle plugin does not support yet the new feature --fully-export-maven-dependencies ... I created the issue now ;), so to make your project work you probably need to change each subproject/.ceylon/config with these options:

[compiler]
source=source
resource=resource

[defaults]
encoding=UTF-8
overrides=build/overrides.xml
flatclasspath=true
fullyexportmavendependencies=false

It will disable the new ceylon feature and uses ceylon gradle plugin feature and the generated overrides.xml file

  • Agreed. It seems to me like this is a problem with the Gradle plugin in that, by default, it does much too much. And in this case -- for perfectly legitimate historical reasons -- it's trying to do stuff that Ceylon 1.3.1 already does. – Gavin King Nov 23 '16 at 08:37
  • 1
    Thanks! The suggested fix makes the build further. Modules `discovery` and `gateway` build without problems, however `foo`, `bar`, and `foobar` fail with duplicate module imports. I think this is caused by the automatic generation of `overrides.xml` instead of using the provided, see source/bar/module.ceylon:2: error: source code imports two different versions of module 'org.springframework.data:spring-data-commons': version '1.12.4.RELEASE' and version '1.12.5.RELEASE' module bar "1.0.0" { – Andres Almiray Nov 24 '16 at 12:31
  • 1
    Right, but theres a issue with the [fix in progress](https://github.com/renatoathaydes/ceylon-gradle-plugin/issues/16), probably it will be fixed in next release and everything will be transparent if you choose gradle or ceylon way to deal with dependencies – Diego Coronel Nov 25 '16 at 20:13