Ceylon 1.3 IntelliJ IDE auto export maven dependencies

47 views
Skip to first unread message

Lucono

unread,
Sep 20, 2016, 2:59:43 AM9/20/16
to ceylon-users
Hi Ceylon Team,

Congratulations on the release of Ceylon 1.3! Also, thank you! ..been looking forward to it for a while.

I just updated to the Ceylon 1.3 IntelliJ IDE and put together a small Spring boot project. It seems the option to "Automatically export maven dependencies" (Project Structure --> Modules --> Ceylon) isn't working. The IDE is able to resolve all package imports from Ceylon module dependencies of the project/module, but not able to resolve _any_ package imports from any of the maven dependencies of the project.

Note that the project is not setup as a maven or gradle project, but a plain Ceylon project, with a module.ceylon file containing some ceylon dependencies as well as some maven dependencies.

Here's the module.ceylon:

native("jvm")
module com.lucono.someapp "1.0.0" {
    
    /* --- Language --- */
    shared import java.base "8";
    shared import ceylon.html "1.3.0";
    import java.jdbc "8";
    import ceylon.interop.java "1.3.0";
    import ceylon.time "1.3.0";
    
    
    /* --- Compile --- */    
    shared import maven:"org.springframework.boot:spring-boot-starter-web" "1.3.3.RELEASE";
    shared import maven:"org.springframework.boot:spring-boot-starter-data-jpa" "1.3.3.RELEASE";
    shared import maven:"org.springframework.boot:spring-boot-starter-jersey" "1.3.3.RELEASE";
    
    
    /* --- Runtime --- */    
    import maven:"org.springframework.boot:spring-boot-starter-jdbc" "1.3.3.RELEASE";
    import maven:"com.h2database:h2" "1.4.191";
    
    
    /* --- Testing ---*/    
    import ceylon.test "1.3.0";
}

Am I doing something wrong, or could this be an issue?

Thanks so much for the great work.

Stephane Epardaud

unread,
Sep 20, 2016, 9:53:24 AM9/20/16
to ceylon...@googlegroups.com
Those `spring-boot-starter` modules appear to be empty and only work as aggregators of other module imports. Because there's no possibility in Maven to describe which dependencies should be exported or not, Ceylon does not make transitive Maven dependencies visible in Ceylon: you have to explicitely import the transitive dependencies you want, such as `org.springframework:spring-web/4.3.2.RELEASE`. 

It's a bit annoying and there's an issue open somewhere where we would make those transitive dependencies visible in Ceylon but in most cases that'd instantly make several hundreds of modules visible to you which would slow down your IDE, confuse your imports and quick-fixes, cause lots of useless downloads and in many cases introduce conflicts you'd have to resolve. With Java 9 this problem will disappear because Maven users will have to describe which module dependencies should be shared.

--
You received this message because you are subscribed to the Google Groups "ceylon-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.
To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceylon-users/5f381cc6-811f-48f1-bc43-e81e5f2b795e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Lucono

unread,
Sep 20, 2016, 11:30:42 AM9/20/16
to ceylon-users
Hi Stéphane,


Ceylon does not make transitive Maven dependencies visible in Ceylon: you have to explicitely import the transitive dependencies you want, such as `org.springframework:spring-
web/4.3.2.RELEASE`.

I understand maven does not define exported dependencies, but I was of the opinion that's what Ceylon IDE's "Automatically export maven dependencies" option is exactly provided for - to treat all of the direct and transitive dependencies of a maven module as "shared"?

The Ceylon reference page on maven module overrides (last paragraph at the bottom of this page) also states the same:

Alternatively, if we use the --auto-export-maven-dependencies flag, we don't need an overrides.xml file at all. That's probably a more robust solution in this case, given that Jetty comprises a number of internal modules with inter-dependencies that are not all captured in the Maven metadata.

Otherwise, what does the Ceylon IDE's "Automatically export maven dependencies" option exactly do?

Thanks.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users...@googlegroups.com.



--
Stéphane Épardaud

Stephane Epardaud

unread,
Sep 20, 2016, 11:36:10 AM9/20/16
to ceylon...@googlegroups.com
It does that, but without polluting your Ceylon modules. It's only between Maven dependencies.

To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-users+unsubscribe@googlegroups.com.

To post to this group, send email to ceylon...@googlegroups.com.
Visit this group at https://groups.google.com/group/ceylon-users.

For more options, visit https://groups.google.com/d/optout.



--
Stéphane Épardaud

Lucono

unread,
Sep 20, 2016, 12:03:37 PM9/20/16
to ceylon-users
Thanks Stéphane ..so using overrides.xml is still the practical (recommended?) way around this for now?

Prior to v1.3, I used the Ceylon gradle plugin for auto-generating the overrides.xml file. However, in the Ceylon 1.3 IntelliJ IDE, I'm not able to add Gradle support to a Ceylon project. Is there a particular process to follow to add that?

Or, is there any other recommended way to automatically make the packages from the Ceylon module's maven dependencies (and their transitive dependencies) visible to the Ceylon module?

Thanks very much.



--
Stéphane Épardaud

Gavin King

unread,
Sep 20, 2016, 12:32:17 PM9/20/16
to ceylon...@googlegroups.com
I think what Stef is saying is that you can use
`--auto-export-maven-dependencies` in order to avoid the need for an
overrides.xml file, but then *explicitly* import just the modules that
you depend on in your Ceylon code.

To me that doesn't seem unreasonable at all.
> https://groups.google.com/d/msgid/ceylon-users/c6c25803-b1af-42a9-99e8-8a622340a491%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Lucono

unread,
Sep 20, 2016, 2:03:50 PM9/20/16
to ceylon-users
Okay, that's the bit I was missing, I'd expected the auto-export option to also make the exported modules visible to project code in the IDE.

Thanks for the clarification.
Reply all
Reply to author
Forward
0 new messages