-
Notifications
You must be signed in to change notification settings - Fork 62
Main API tries and fails to load an optional dependency #4775
Comments
[@quintesse] @jvasileff See https://repo1.maven.org/maven2/com/google/guava/guava-parent/18.0/guava-parent-18.0.pom for the JSR version. |
[@quintesse] Btw @FroMage , as you can see it's not during compilation but at runtime that this error occurs. It seems it's trying to register the metamodel for the optional module which isn't available. At least that's my guess. |
[@quintesse] NB: should the |
[@jvasileff] Oh, that makes sense. And, it's not listed as optional in the parent pom; maybe that has something to do with it. On a related note, it looks like Main makes a network connection to download poms if necessary. I guess that makes sense, especially here, but it's not something I'd want on a production server. |
Try setting the offline mode. (I'm not really sure if the Main API makes that easy to do, @FroMage ?) |
[@FroMage] In theory the As for including the optional jars by default in classpath, I guess that's a good idea, but would it fix the problem here? |
That was already implemented some time ago, it should work. |
[@quintesse](the thing we don't support yet are timeouts because the Aether stuff doesn't have an API for that) |
[@FroMage] Not for this IIRC. |
[@quintesse] Are you sure? I remember this was tested when we added it to the resolver: Wasn't the problem with that issue that you can't just read the information from the POM without it trying to download the artifacts (when offline=false) |
[@FroMage] Yes, as the comments say, there's no way to make aether read just the pom file without resolving. I suppose that if I set it to offline it will not hit the net, though, so it should stick to the local cache, which should work. |
[@alesj] I've added this test and it passes:
|
[@quintesse] @jvasileff This seems to work now for me. Could you confirm so we can close this? |
[@jvasileff] But, I'm afraid there is more to this. The following still fail: Running without the Main api:
Running without the Main api, without guava, but with
Running with the Main api, with or without guava, but with
Note: So, I suspect there are two issues:
For reference, my module simple "1.0.0" {
// comment/uncomment one or both of these:
import "com.google.guava:guava" "18.0";
import "com.google.code.findbugs:jsr305" "1.3.9";
} |
[@quintesse] |
[@jvasileff] Oops. So |
[@quintesse] I tried it with both imported and it still seemed to work fine. What problem are you seeing? |
[@quintesse] Ah no, I have reproduced it |
[@jvasileff] Not a super controlled test, but it looks like the tool provider API is indeed affected: [tomcat] Caused by: java.lang.RuntimeException: Missing module: com.google.code.findbugs:jsr305/1.3.9
[tomcat] at com.redhat.ceylon.compiler.java.runtime.tools.impl.JavaRunnerImpl.loadModule(JavaRunnerImpl.java:212)
[tomcat] at com.redhat.ceylon.compiler.java.runtime.tools.impl.JavaRunnerImpl.loadModule(JavaRunnerImpl.java:224)
[tomcat] at com.redhat.ceylon.compiler.java.runtime.tools.impl.JavaRunnerImpl.<init>(JavaRunnerImpl.java:65)
[tomcat] at com.redhat.ceylon.compiler.java.runtime.tools.CeylonToolProvider.getRunner(CeylonToolProvider.java:27)
[tomcat] at com.redhat.ceylon.war.WarInitializer.initialize(WarInitializer.java:85) |
[@quintesse] Well it's indeed because the findbugs jar does not have any meta data at all. |
[@jvasileff]
|
[@quintesse] Well to be honest @jvasileff I'd like to close this issue if you don't mind because I think the original problem is now fixed. Please open a new issue in |
[@jvasileff] @quintesse ok, done. Thanks. |
[@jvasileff] Running a basic hello-world program with:
using:
fails with:
The jsr305 module is an optional dependency of Guava - see https://repo1.maven.org/maven2/com/google/guava/guava/18.0/guava-18.0.pom
ceylon classpath ...
listsguava-18.0.jar
, but, as expected, notjsr305.jar
.One interesting item: I have no idea where Main is getting the version number in
jsr305/1.3.9
. Guava's pom.xml does not specify a version.[Migrated from ceylon/ceylon-module-resolver#113]
[Closed at 2015-02-04 22:52:01]
The text was updated successfully, but these errors were encountered: