Open jbeckers opened 3 weeks ago
Or 2/ when resolving, add the jpms modules to the module libraries in a new category. Questions: does the intellij project model support this?
I'm not sure this is necessary? It seems that IntelliJ has some smart logic to put the dependencies in the correct module/class path: https://youtrack.jetbrains.com/issue/IDEA-171320/Set-module-path-and-class-path
On compilation of a module with module-info, IDEA would put all (transitively) required dependencies specified in module-info on the module path, everything else would be left on the class path, similarly how it's done in maven
Not sure about this, but wouldn't you need to add the "mod" artifact type to the "Classes" category in the settings (see your screenshot)?
Ok, I'm starting to make sense of this, but I'm not liking what I find. 😆
Reading the youtrack and others, it seems like I needn't change a thing in ivy. The result of ivy resolve gives me a set of jars (old-style and/or jpms) and deciding which of those to actually put on the module path needs to be done based on module-info.
I was hoping to avoid putting module-info in the module that needs nashorn, since this turns the module into a jpms module (right?) and we're not ready for that.
If IntelliJ provides no other options to add mods to the module path (apart from manually specifying the --module-path in the run configuration), I seem to be stuck.
I'm still wondering whether the JRE/JPMS itself will force me to add module-info. Not easy to get my head around.
Let me try some things and get back in a few days.
I'm trying to use Ivy/IvyIDEA to build a jpms module path.
(In my case to get Nashorn on the module path, e.g. https://github.com/szegedi/nashorn/wiki/Using-Nashorn-with-different-Java-versions#using-nashorn-on-java-11-to-14)
I think Ivy has everything I need to do this. I'm not so sure about IntelliJ and IvyIDEA.
In ivy.xml, I'll to model this by changing the type of the artifact to "mod" instead of "jar"
Then in our ant build scripts, I'll do two resolves:
So far, so good, I think? This should work for ant. But what about IntelliJ? IvyIDEA probably needs some work to support this.
At first guess:
1/ add a category "JPMS Modules" to the IvyIDEA settings:
2/ when resolving, create (an) extra module librar(y/ies) that only contains the jpms modules? Questions: does the intellij project model support this? Do we need an extra library per configuration?
3/ when running, add these libraries to the module path somehow?
I'm willing to do some work on this, but I thought I'd ask if any work has been done already before starting.