Re: Multiple source roots?
Maciej Jaros <[email protected]> Fri, 19 Sep 2025 11:12:21 +0200
| Newsgroups | gmane.comp.java.ide.netbeans.user |
|---|---|
| Organization | MOL sp. z o.o. |
| Message-ID | <[email protected]> |
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" xmlns:xsi="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"> <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