Compile time vs. runtime deps
Paul Sandoz
paul.sandoz at oracle.com
Thu Jul 12 04:58:15 PDT 2012
On Jul 12, 2012, at 2:54 AM, David Holmes wrote:
> On 11/07/2012 11:24 PM, Jaroslav Tulach wrote:
>> Dne St 11. července 2012 18:33:41, David Holmes napsal(a):
>>> On 11/07/2012 5:22 PM, Jaroslav Tulach wrote:
>>>> Dne St 11. července 2012 08:59:20, Paul Sandoz napsal(a):
>>>>> On Jul 11, 2012, at 8:28 AM, David Holmes wrote:
>>>
>>>> I believe both cases are possible. I can have optional dependency I need
>>>> to
>>>> compile against and I can as well have another optional dependency I don't
>>>> need to compile against.
>>>>
>>>> There needs to be a way to express that properly to Jigsaw runtime as well
>>>> as Javac.
>>>
>>> I don't see why I need to make the distinction to the compiler. I
>>> declare an optional dependency and at compile-time it is, or isn't
>>> found.
>>
>> That could produce different result during the compilation. The compilation
>> could either succeed or fail. Javac and IDEs need to know whether the optional
>> (in runtime) library should or should not be on the compilation "classpath".
>
> You mean the tools are going to dynamically examine my module-info.java/class and use it to determine what they should set modulepath/classpath to ???
>
> That is not something I would have expected at all. If I build a project and the optional, but needed at compile-time, module is not present then I get a compilation error: type XXX not found. It is then up to me to realize that I am missing the module that exports XXX and either install it to the main library or add the library it is in to the appropriate path. (Just as I would have to add the jar file today.)
>
Maven has saved many a developer, when building a project, from the pain of manually dealing with jars!
If the compile-time dependency was made explicit then tooling and/or the module system can automate what would otherwise be a manual process.
Paul.
More information about the jigsaw-dev
mailing list