ceylon / ceylon-compiler

DEPRECATED
GNU General Public License v2.0
138 stars 36 forks source link

Resolution of transitive maven dependencies not working in some cases #2403

Open marklester opened 8 years ago

marklester commented 8 years ago

module.xml:

native("jvm")
module test.examples.ceylon.postgres "1.0.0" {
    import ceylon.dbc "1.2.0";
    import ceylon.test "1.2.0";
    import examples.ceylon.postgres "1.0.0";
    import "de.flapdoodle.embed:de.flapdoodle.embed.process" "1.41.2";
    import "ru.yandex.qatools.embed:postgresql-embedded" "1.4";
    import "postgresql:postgresql" "9.1-901-1.jdbc4";
}

stack trace when I try to run the test

java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
    at ru.yandex.qatools.embed.postgresql.config.AbstractPostgresConfig$Storage.<init>(AbstractPostgresConfig.java:87)
    at ru.yandex.qatools.embed.postgresql.config.AbstractPostgresConfig$Storage.<init>(AbstractPostgresConfig.java:82)
    at ru.yandex.qatools.embed.postgresql.config.PostgresConfig.<init>(PostgresConfig.java:19)
    at ru.yandex.qatools.embed.postgresql.config.PostgresConfig.defaultWithDbName(PostgresConfig.java:40)
    at test.examples.ceylon.postgres.testStoreAndLoad_.testStoreAndLoad(ModelTests.ceylon:30)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.FunctionImpl.$call$(FunctionImpl.java:290)
    at com.redhat.ceylon.compiler.java.Util.apply(Util.java:1450)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.apply(Metamodel.java:1822)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.meta.FunctionImpl.apply(FunctionImpl.java:442)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.FunctionDeclarationImpl.invoke(FunctionDeclarationImpl.java:237)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.FunctionDeclarationImpl.invoke(FunctionDeclarationImpl.java:226)
    at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.FunctionDeclarationImpl.invoke(FunctionDeclarationImpl.java:219)
    at ceylon.test.core.DefaultTestExecutor.invokeFunction$priv$(DefaultTestExecutor.ceylon:237)
    at ceylon.test.core.DefaultTestExecutor.access$100(DefaultTestExecutor.ceylon:20)
    at ceylon.test.core.DefaultTestExecutor$4.$call$(DefaultTestExecutor.ceylon:205)
    at ceylon.test.core.DefaultTestExecutor$2.$call$(DefaultTestExecutor.ceylon:172)
    at ceylon.test.core.DefaultTestExecutor$3.$call$(DefaultTestExecutor.ceylon:179)
    at ceylon.test.core.DefaultTestExecutor$1.$call$(DefaultTestExecutor.ceylon:152)
    at ceylon.test.core.DefaultTestExecutor.execute(DefaultTestExecutor.ceylon:32)
    at ceylon.test.core.DefaultTestRunner$5$1.next(DefaultTestRunner.ceylon:60)
    at ceylon.language.Array.createArrayFromIterable(Array.java:157)
    at ceylon.language.Array.<init>(Array.java:106)
    at ceylon.language.Iterable$impl.sequence(Iterable.ceylon:251)
    at ceylon.language.impl.BaseIterable.sequence(bases.ceylon)
    at ceylon.test.core.DefaultTestRunner.run(DefaultTestRunner.ceylon:60)
    at com.redhat.ceylon.testjvm.Runner.run(tool.ceylon:84)
    at com.redhat.ceylon.testjvm.run_.run(tool.ceylon:36)
    at com.redhat.ceylon.testjvm.run_.main(tool.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:75)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:122)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:106)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.jboss.modules.Module.run(Module.java:312)
    at org.jboss.modules.Main.main(Main.java:460)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:244)
    at ceylon.modules.bootstrap.CeylonTestTool.run(CeylonTestTool.java:174)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:491)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:380)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:114)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:41)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:34)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:27)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils from [Module "ru.yandex.qatools.embed:postgresql-embedded:1.4" from Ceylon ModuleLoader: RootRepositoryManager: FileContentStore: /home/mark/.ceylon/cache]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)
    ... 57 more
FroMage commented 8 years ago

Try adding the import manually:

import "org.apache.commons:commons-lang3" "3.4";

And run with --flat-classpath. I still have to check why it doesn't work but it may unblock you.

marklester commented 8 years ago

I checked "Use a flat classpath" in the ide and still the same problem.

FroMage commented 8 years ago

That's weird, can you try from the command-line? In theory with that option it should not even use jboss modules at all.

marklester commented 8 years ago
ceylon compile --flat-classpath
Note: Created module test.examples.ceylon.postgres/1.0.0
Note: Created module examples.ceylon.postgres/1.0.0

then

ceylon test test.examples.ceylon.postgres/1.0.0

same error

FroMage commented 8 years ago

No, use the flag on Ceylon run ;)

FroMage commented 8 years ago

Ah good point, perhaps we forgot to add it to Ceylon test...

marklester commented 8 years ago

I don't have a run yet. I wanted to start with tests

FroMage commented 8 years ago

Damn, I forgot to add it to the test tool indeed. Meanwhile try it with the run tool, possibly by running the test tool manually:

print("Test results: ``createTestRunner([`module`], []).run()``);

I haven't tried it so not sure it will work as is, but it should be close enough, right @thradec?

FroMage commented 8 years ago

2404

marklester commented 8 years ago

awesome. Are you still going to figure out why it dies without the --flat-classpath argument?

marklester commented 8 years ago

yeah just moved the test into a run and it kicked the can further down the road. Thanks for the help