Converting plain JARs to Java modules

Eric Johnson eric at tibco.com
Wed Nov 9 08:02:20 PST 2011


We've struggled with this question in conjunction with OSGi.

We started out using OSGi's require-bundle - and got badly burned as 
certain Java packages moved around from bundle to bundle as we switched 
operating environments. Trouble really stems from Java's language 
design, more than anything else - language namespaces (a.k.a. packages) 
aren't associated with a JAR, but have a separate logical existence. 
This means that at runtime at least, you need dependency information at 
a package level.

You may want less fine-grained dependencies at other times (say, for 
example, packaging for the Linux platform). At least if you have 
package-level information, you can likely generate correct dependency 
information at the module level, but definitely *not* the other way around.

-Eric.

On 11/9/11 3:04 PM, David M. Lloyd wrote:
> I'll just state now that using packages as a dependency unit is a 
> terrible idea, and not some architectural revelation.  That way, 
> Peter's wrath will be largely directed at me. :-)
>
> On 11/09/2011 08:02 AM, Peter Kriens wrote:
>> I agree that tools are needed but we must be careful to not expect 
>> tools to stopgap an architectural issue. I think it is important to 
>> first do good architectural design leveraging existing tools (e.g. 
>> the Java type system) before you try to add new tools. It is such a 
>> pity (but all to common) that a design allows for classes of errors 
>> that would be impossible with a slightly different design.
>>
>> Kind regards,
>>
>>     Peter Kriens
>>
>>
>>
>>
>>
>>
>>
>> On 9 nov. 2011, at 14:49, Alan Bateman wrote:
>>
>>> On 09/11/2011 13:04, Peter Kriens wrote:
>>>> The issue is that maven problems are not caused because maven is 
>>>> bad or that pom authors are stupid. The reason is that the 
>>>> module-to-module dependency architecture in maven (and Jigsaw) is 
>>>> error prone ...
>>> This thread started out with someone asking about adding module 
>>> declarations to existing JAR files, and in that context, I agree it 
>>> can be error prone without good tools. I think things should be a 
>>> lot better when modules are compiled.
>>>
>>> -Alan.
>>>
>>
>
>



More information about the jigsaw-dev mailing list