-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Main API tries and fails to load an optional dependency #113
Comments
@jvasileff See https://repo1.maven.org/maven2/com/google/guava/guava-parent/18.0/guava-parent-18.0.pom for the JSR version. |
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. |
NB: should the |
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 ?) |
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. |
(the thing we don't support yet are timeouts because the Aether stuff doesn't have an API for that) |
Not for this IIRC. |
See #87 (comment) |
Are you sure? I remember this was tested when we added it to the resolver: ceylon-module-resolver/maven/src/main/java/com/redhat/ceylon/cmr/maven/AetherUtils.java Line 318 in 156f46f
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) |
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. |
I've added this test and it passes:
|
…optional state of the maven artifact (#113)
@alesj This wasn't so much about the CMR not finding the artifacts but about @jvasileff This seems to work now for me. Could you confirm so we can close this? |
@quintesse great, that helps! Indeed, 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";
} |
@jvasileff you're using a wrong command line syntax. Everything after the module name for "ceylon run" are supposed to be arguments for the program you're running. So the |
Oops. So |
I tried it with both imported and it still seemed to work fine. What problem are you seeing? |
Ah no, I have reproduced it |
…r dependency (find while fixing ceylon/ceylon-module-resolver#113)
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) |
Well it's indeed because the findbugs jar does not have any meta data at all. |
Incidentally, compiling with jsr305 fails if you also need
|
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 |
@quintesse ok, done. Thanks. |
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.The text was updated successfully, but these errors were encountered: