Re: Multiple source roots?
Maciej Jaros <[email protected]> Sun, 21 Sep 2025 13:40:39 +0200
| Newsgroups | gmane.comp.java.ide.netbeans.user |
|---|---|
| Organization | MOL sp. z o.o. |
| Message-ID | <[email protected]> |
I might have missed something, but I found migrating to IntelliJ quite hard because it doesn't seem to handle profiles like NetBeans does. I know it can be made to work in IJ, since some devs in our company put effort into doing that. From what I know, they had to re-do most of the builds and deployments specifically for IJ. This gets weird if your team uses both NetBeans and IntelliJ (it did get weird for us). What I actually like about NetBeans is that most of the project configuration is taken directly from the pom, which is more universal (pom is a standard). Some of others discussing here also mentioned this saying that NB is a GUI for the build system. To be fair I think it is a bit more, but I like that it's not much more then that. Using Maven as much as possible makes the project work both in CI tools and in NB (and even in IJ partially). I don't know if something has changed since 2023, but I wasn't able to open related projects together in IntelliJ. It seems IJ doesn't have the concept of a workspace (like project groups in NetBeans). In IJ, every project was just opened in a new window, which I personally find strange for an IDE. I guess IJ expects you to define some kind of multi-root setup, whereas in NB you just open the projects you need. Maybe that's the part you missed? E.g. this is a screen from 3 projects opened in one group, 2 small projects and one large project with modules. I could even open a PHP project with completely different set of build tools. I can define all that as a project group (workspace). Perhaps that will work for you. As for build profiles, I think you might have missed how they work in NB. Coming from IJ, you might expect build profiles not to do much. From what I know, in IJ profiles are buried deep in a separate Maven tab. In NB, they actually reduce a lengthy list of profiles to just the one required within the selected profile. This makes it easy to focus on a specific part of a large system. It works for me anyway. So it's not like in NB, where you choose a profile you actually work on (which impacts both the build process and the list of modules I mentioned). Sure, Maven builds are hard to understand at first. But most of that can be generated when you create a project. It gets more complicated as the project evolves, but thankfully these days you can paste your pom into a GPT/LLM and it will describe it for you. And most of the daily in pom changes are just version properties updates, so average dev don't need to understand that. Regards, Maciej Nux Blake McBride (2025-09-19 16:00): > IntelliJ does indeed understand project structure. In fact, multiple > source roots in IntelliJ are trivial. > > Blake > > On Fri, Sep 19, 2025 at 4:14 AM Maciej Jaros > <[email protected]> wrote: > > I used InteliJ and I didn't like that it doesn't really understand > project structure and especially profiles. NB works with maven to > figure out dependencies and you can use profiles to share build > groups with other devs. > > For example here you have a full build and a utils build that can > be built separately (not always great, but it works good enough in > NB): > > <?xml version="1.0" encoding="UTF-8"?> > <project xmlns="http://maven.apache.org/POM/4.0.0" > <http://maven.apache.org/POM/4.0.0> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <http://www.w3.org/2001/XMLSchema-instance> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > https://maven.apache.org/xsd/maven-4.0.0.xsd" > <http://maven.apache.org/POM/4.0.0https://maven.apache.org/xsd/maven-4.0.0.xsd>> > > <modelVersion>4.0.0</modelVersion> > <groupId>pl.myproject</groupId> > <artifactId>myproject</artifactId> > <version>1.0-SNAPSHOT</version> > <packaging>pom</packaging> > <name>myproject</name> > > <modules> > <module>myproject-core</module> > <module>myproject-saas</module> > <module>myproject-utils</module> > <module>myproject-dwh</module> > <module>myproject-lms-client</module> > <module>myproject-extapp</module> > <module>myproject-opac</module> > </modules> > > <profiles> > <!-- default --> > <profile> > <id>full</id> > <activation> > <activeByDefault>true</activeByDefault> > </activation> > <modules> > <module>myproject-core</module> > <module>myproject-saas</module> > <module>myproject-lms-client</module> > <module>myproject-extapp</module> > <module>myproject-aash</module> > <module>myproject-utils</module> > <module>myproject-dwh</module> > <module>myproject-opac</module> > </modules> > </profile> > > <!-- UTILS --> > <profile> > <id>utils-build-only</id> > <properties> > <skip.integration.tests>true</skip.integration.tests> > <skip.unit.tests>true</skip.unit.tests> > </properties> > <modules> > <module>myproject-saas</module> > <module>myproject-utils</module> > </modules> > </profile> > <profile> > <id>utils-development</id> > <properties> > <skip.integration.tests>true</skip.integration.tests> > </properties> > <modules> > <module>myproject-saas</module> > <module>myproject-utils</module> > </modules> > </profile> > <profile> > <id>utils-full</id> > <modules> > <module>myproject-saas</module> > <module>myproject-utils</module> > </modules> > </profile> > </profiles> > > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-compiler-plugin</artifactId> > <version>3.14.0</version> > <configuration> > <release>17</release> > <encoding>UTF-8</encoding> > </configuration> > </plugin> > </plugins> > </build> > > <dependencies> > <dependency> > <groupId>org.apache.logging.log4j</groupId> > <artifactId>log4j-core</artifactId> > <version>2.24.3</version> > </dependency> > <dependency> > <groupId>org.junit.jupiter</groupId> > <artifactId>junit-jupiter-engine</artifactId> > <scope>test</scope> > </dependency> > </dependencies> > > </project> > > > > 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 >