Re: Multiple source roots?

Maciej Jaros <[email protected]> Fri, 19 Sep 2025 11:24:47 +0200
Newsgroups gmane.comp.java.ide.netbeans.user
Organization MOL sp. z o.o.
Message-ID <[email protected]>
Blake McBride (2025-09-18 22:42):
> According to ChatGPT:
>
> If you have *multiple source roots*, Maven itself only supports a 
> *single* |<sourceDirectory>| and |<testSourceDirectory>| in the 
> |<build>| section. To handle *more than one*, you need to *declare one 
> as the “main”* and then use the |build-helper-maven-plugin| to add the 
> rest.
>
> This is one of many reasons I resorted to my own build system.
>
> (BTW, IntelliJ supports any number of source roots.)
>
> --blake

BTW. Assuming those multiple roots are not just random projects, but are 
actually connected with each other then you will probably want to keep 
some dependencies in sync. So even though I can run my utils and my 
extapp project separately (one builds as jar and the other as war), I 
can still keep the same Java in them and some version properties:
     <properties>
         <java.version>17</java.version>
<maven.compiler.release>${java.version}</maven.compiler.release>

<version.CopyrightYears>2013-2025</version.CopyrightYears>

         <!-- 
https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin 
-->
<maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
         <!-- 
https://mvnrepository.com/artifact/org.springframework/spring-core -->
         <spring.version>6.1.21</spring.version>
     </properties>

And then I can use those properties in other poms.

Regards,
Maciej Nux