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


On Thu, Sep 18, 2025 at 3:01 PM Michael Bien <[email protected]> wrote:

> NetBeans reads the build configuration to reason over the project. It
> interfaces
> with the build tool to figure out what the project structure is.
>
> Lets say you have a maven project which is buildable using the terminal.
>
> NB can open it, build an internal model, discover all sources,
> dependencies,
> subprojects etc. Once done, NB will know where method 2 is which is called
> by method 1 and allow you to navigate between them etc.
>
> There is no such thing as a "NetBeans project" where you tell NB where
> the resources are and how to build them. NB interfaces with the build tool,
> since the build (pom.xml to stay with the example) knows everything
> already.
>
> There is optional extra configuration you can add. E.g to remember what
> specific JDK you want to use for a specific project, but other than that
> there is nothing NB specific to configure.
>
> try creating a new maven project using the wizard, you will
> see it has nothing in it except the pom and a java file.
>
> -mbien
>
>
> On 9/18/25 21:41, Blake McBride wrote:
> > Thanks, Michael.  However, I am not talking about the build process
> here.  I am talking about the IDE's ability to resolve references.  In
> other words, if method 1 calls method 2 and they're in different source
> roots the IDE needs to understand that.
> >
> > Thanks.
> >
> > Blake
> >
> >
> > On Thu, Sep 18, 2025 at 1:40 PM Michael Bien <[email protected]> wrote:
> >
> >     depends on the project type.
> >
> >     for ant its in the project properties window (right click). simply
> add another source folder using the UI.
> >
> >     maven is all about convention, you add for example the
> build-helper-maven-plugin and tell it
> >     where the additional folder is. It will show up under "Other
> Sources" in the tree.
> >     (project properties window has some info in the source section)
> >
> >     for gradle I don't know unfortunately, but I am sure its in the
> gradle doc somewhere.
> >     if you configure it in the build, NB should find it.
> >
> >     best regards,
> >     michael
> >
> >     On 9/18/25 20:15, Blake McBride wrote:
> >     > If my Java project has multiple source roots, how can I specify
> that in NetBeans?
> >     >
> >
>
>

Reply via email to