Re: Starting a pure Java 9 modular project

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Starting a pure Java 9 modular project

Karl Heinz Marbaise-3
Hi Mark,

On 18/09/17 17:11, Mark Raynsford wrote:

> Hello.
>
> With Java 9 due out in a few days time, I'm looking at moving all of my
> 60+ projects to Java 9. I have no intention of keeping support for any
> version of Java less than 9, so the projects will become pure Java 9
> (modularized) projects.
>
> I'm curious as whether Java 9 changes any of the conventions that I've
> been used to in Maven for the past five or so years. For example, one
> thing I see frequently in Java 9 tutorials is that they use a
> directory layout that differs from the Maven standard. For example,
> consider this tutorial:
>
>    https://dzone.com/articles/java-9-tutorial-step-by-step-from-zero-to-modules
>
> The directory layout is "src/com.me.mymodule/module-info.java". This
> obviously doesn't match the "src/main/java" convention that Maven uses.

That is the same which comes to my mind if I see such examples...

But I don't see any requirement for that nor do I see any advantage
about this approache?...

What I've seen in OSGi is to name the directories according to the
modules (bundle names) but this often leads into duplication
like:

root
  +-- com.company.project.x1
  +-- com.company.project.x2
  +-- com.company.project.x3..

which form my point view could be reduced to:

root
  +-- x1
  +-- x2
  +-- x3

I've made several tests like this
https://github.com/khmarbaise/jdk9-jlink-jmod-example/tree/master/maven-example

where I'm working on JMod / JLink parts...

I think the best suggestion I can give is to keep the conventions
...cause from my current point of view you don't have disadvantages...

But we would be very interested if there are some if you make
experiences in that way...

>
> Is the intention to map Maven modules 1:1 with Jigsaw modules? Or if
> not 1:1, then perhaps "no more than one Jigsaw module per Maven module".

I think one Jigsaw module per Maven module otherwise you need to leave
the conventions based on module-info.java....etc...

>
> Is there documentation available anywhere that describes how new pure
> Java 9 (multi-module!) projects should be set up?
>

I think it's time to make some docs based on the current state of
experience and if you like please add information or begin with such
docs about that..we would appreciate such things...

Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Starting a pure Java 9 modular project

org.apache.maven.user
On 2017-09-18T19:06:12 +0200
Karl Heinz Marbaise <[hidden email]> wrote:

> Hi Mark,
>
> On 18/09/17 17:11, Mark Raynsford wrote:
> >
> > The directory layout is "src/com.me.mymodule/module-info.java". This
> > obviously doesn't match the "src/main/java" convention that Maven uses.  
>
> That is the same which comes to my mind if I see such examples...
>
> But I don't see any requirement for that nor do I see any advantage
> about this approache?...
Me neither. I get the feeling they just made one up as they modularized
the JDK. I've built the JDK quite a few times, but I never actually
looked into what they're using to build the Java sources. It appears
that it's just Makefiles, so they presumably didn't have the
conventions of any existing tool to work with.

> What I've seen in OSGi is to name the directories according to the
> modules (bundle names) but this often leads into duplication
> like:

Yep, I actually adopted this convention myself at the start of the
year. I think the one advantage to this over the short form is that it
can make it slightly easier to find modules in the filesystem if you
have a lot of source trees:

  $ find . -name 'com.io7m.example' -type d

> I think the best suggestion I can give is to keep the conventions
> ...cause from my current point of view you don't have disadvantages...
>
> But we would be very interested if there are some if you make
> experiences in that way...

Yeah, I would prefer to stick to the Maven conventions.

> > Is the intention to map Maven modules 1:1 with Jigsaw modules? Or if
> > not 1:1, then perhaps "no more than one Jigsaw module per Maven module".  
>
> I think one Jigsaw module per Maven module otherwise you need to leave
> the conventions based on module-info.java....etc...

Right.

> > Is there documentation available anywhere that describes how new pure
> > Java 9 (multi-module!) projects should be set up?
> >  
>
> I think it's time to make some docs based on the current state of
> experience and if you like please add information or begin with such
> docs about that..we would appreciate such things...

Well, in a few weeks time, I'll have at least attempted to modularize
some 60 different projects. They're all OSGi compatible, so the
difficult work has already been done. Just need to write module
descriptors and update plugins and definitions to produce 9 bytecode.

I can certainly write something up. Where would I be putting this
documentation?

--
Mark Raynsford | http://www.io7m.com

attachment0 (849 bytes) Download Attachment