Hello all

The Maven folder structure differs from the folder structure expected by
standard javac and javadoc tools:

  * *Maven:* <maven-module-artifactIDs>/src/main/java/<packages>/<classes>
  * *Java:* <jigsaw.module.names>/<packages>/<classes>

I understand that Maven can still build a Java 9 project by compiling
each module with a separated invocation of javac, and I have seen the
"do and don't with Java 9" recommendation to not change the Maven folder
structure (slide 38 of [1]). Nevertheless I'm considering to try
changing some projects folder structure to match the Java 9 convention.
Reasons are:

  * We now have two conflicting conventions: Maven and Java 9. I'm
    tented to choose the one used by the most "fundamental" tool for the
    reasons below.
  * I have not yet been able to generate aggregated Javadoc for a
    project following Maven directory structure. Even when using javadoc
    on the command-line, the tools insists for having a directory
    structure matching the Java 9 conventions (maybe I have not found
    the right command-line options yet).
  * Even if the above-cited problem can be solved by appropriate
    command-line options, complying with Java 9 conventions would make
    easier to use javac, javadoc or other tools on the command line for
    multi-modules projects (even if Maven still the primary build tool,
    I sometime want to do experiments manually).
  * Even if Maven is the "official" build tools in a project, I like to
    provide NetBeans project files (the Ant script generated by
    NetBeans) for convenience. I know that NetBeans has excellent Maven
    integration, but NetBeans projects are still faster to build,
    execute and debug, allow to configure hints, to customize
    spell-check entries, to specify the copyright header in new files,
    etc. So I develop with NetBeans and launch Maven only for
    verification before to commit or for deployments/releases. But
    NetBeans 9-snapshot multi-modules project seems to require
    compliance with Java 9 conventions.

Rémi Forax proposes another build tools with a directory structure
adapted to Java 9 conventions [2]. Basically instead of
"<module>/src/main/java" he uses "src/main/java/<module>". Has anyone
considered to use such directory structure in a Maven project? I realize
that it would requires customizing the pom.xml files and that it put the
main source code (src/main/java) and the test (src/test/java) further
apart (main and test no longer in the same module directory). I'm having
hesitation about whether the advantages would be worth the inconvenient.

Related question: would Maven consider to support an alternative
directory structure convention more "naturally" compatible with Java 9
conventions (meaning: allowing a modular "Hello world" to be compilable
with a minimal set of javac options)?

    Regards,

        Martin

[1] 
https://fr.slideshare.net/RobertScholte/the-dos-and-donts-with-java-9-devoxx-2017
[2] https://github.com/forax/pro-demo/#a-simple-modular-application

Reply via email to