@@ -729,17 +729,15 @@ private void initProject(MavenProject project, ModelBuilderResult result) {
729729 if (isModularProject ) {
730730 if (hasMainResources ) {
731731 // Modular project with resources configured via <sources> - already added above
732- if (!resources .isEmpty ()
733- && !hasOnlySuperPomDefaults (resources , baseDir , ProjectScope .MAIN .id ())) {
732+ if (hasExplicitLegacyResources (resources , baseDir , ProjectScope .MAIN .id ())) {
734733 logger .warn ("Legacy <resources> element is ignored because main resources are "
735734 + "configured via <source><lang>resources</lang></source> in <sources>" );
736735 }
737736 logger .debug (
738737 "Main resources configured via <sources> element, ignoring legacy <resources> element" );
739738 } else {
740739 // Modular project without resources in <sources> - inject module-aware defaults
741- if (!resources .isEmpty ()
742- && !hasOnlySuperPomDefaults (resources , baseDir , ProjectScope .MAIN .id ())) {
740+ if (hasExplicitLegacyResources (resources , baseDir , ProjectScope .MAIN .id ())) {
743741 String message =
744742 "Legacy <resources> element is ignored because modular sources are configured. "
745743 + "Use <source><lang>resources</lang></source> in <sources> for custom resource paths." ;
@@ -769,8 +767,7 @@ private void initProject(MavenProject project, ModelBuilderResult result) {
769767 // Classic (non-modular) project
770768 if (hasMainResources ) {
771769 // Resources configured via <sources> - already added above
772- if (!resources .isEmpty ()
773- && !hasOnlySuperPomDefaults (resources , baseDir , ProjectScope .MAIN .id ())) {
770+ if (hasExplicitLegacyResources (resources , baseDir , ProjectScope .MAIN .id ())) {
774771 logger .warn ("Legacy <resources> element is ignored because main resources are "
775772 + "configured via <source><lang>resources</lang></source> in <sources>" );
776773 }
@@ -794,8 +791,7 @@ private void initProject(MavenProject project, ModelBuilderResult result) {
794791 if (isModularProject ) {
795792 if (hasTestResources ) {
796793 // Modular project with test resources configured via <sources> - already added above
797- if (!testResources .isEmpty ()
798- && !hasOnlySuperPomDefaults (testResources , baseDir , ProjectScope .TEST .id ())) {
794+ if (hasExplicitLegacyResources (testResources , baseDir , ProjectScope .TEST .id ())) {
799795 logger .warn (
800796 "Legacy <testResources> element is ignored because test resources are "
801797 + "configured via <source><lang>resources</lang><scope>test</scope></source> in <sources>" );
@@ -804,8 +800,7 @@ private void initProject(MavenProject project, ModelBuilderResult result) {
804800 "Test resources configured via <sources> element, ignoring legacy <testResources> element" );
805801 } else {
806802 // Modular project without test resources in <sources> - inject module-aware defaults
807- if (!testResources .isEmpty ()
808- && !hasOnlySuperPomDefaults (testResources , baseDir , ProjectScope .TEST .id ())) {
803+ if (hasExplicitLegacyResources (testResources , baseDir , ProjectScope .TEST .id ())) {
809804 String message =
810805 "Legacy <testResources> element is ignored because modular sources are configured. "
811806 + "Use <source><lang>resources</lang><scope>test</scope></source> in <sources> for custom resource paths." ;
@@ -835,8 +830,7 @@ private void initProject(MavenProject project, ModelBuilderResult result) {
835830 // Classic (non-modular) project
836831 if (hasTestResources ) {
837832 // Test resources configured via <sources> - already added above
838- if (!testResources .isEmpty ()
839- && !hasOnlySuperPomDefaults (testResources , baseDir , ProjectScope .TEST .id ())) {
833+ if (hasExplicitLegacyResources (testResources , baseDir , ProjectScope .TEST .id ())) {
840834 logger .warn (
841835 "Legacy <testResources> element is ignored because test resources are "
842836 + "configured via <source><lang>resources</lang><scope>test</scope></source> in <sources>" );
@@ -1253,7 +1247,7 @@ public Set<Entry<K, V>> entrySet() {
12531247 * @param sources list of source elements from the build
12541248 * @return set of non-blank module names
12551249 */
1256- private Set <String > extractModules (List <org .apache .maven .api .model .Source > sources ) {
1250+ private static Set <String > extractModules (List <org .apache .maven .api .model .Source > sources ) {
12571251 return sources .stream ()
12581252 .map (org .apache .maven .api .model .Source ::getModule )
12591253 .filter (Objects ::nonNull )
@@ -1292,17 +1286,17 @@ private DefaultSourceRoot createModularResourceRoot(
12921286 }
12931287
12941288 /**
1295- * Checks if the given resource list contains only Super POM default resources.
1296- * Super POM defaults are: src/{scope}/resources and src/{scope}/resources-filtered
1289+ * Checks if the given resource list contains explicit legacy resources that differ
1290+ * from Super POM defaults. Super POM defaults are: src/{scope}/resources and src/{scope}/resources-filtered
12971291 *
12981292 * @param resources list of resources to check
12991293 * @param baseDir project base directory
13001294 * @param scope scope (main or test)
1301- * @return true if only Super POM defaults are present
1295+ * @return true if explicit legacy resources are present that would be ignored
13021296 */
1303- private boolean hasOnlySuperPomDefaults (List <Resource > resources , Path baseDir , String scope ) {
1297+ private boolean hasExplicitLegacyResources (List <Resource > resources , Path baseDir , String scope ) {
13041298 if (resources .isEmpty ()) {
1305- return false ;
1299+ return false ; // No resources means no explicit legacy resources to warn about
13061300 }
13071301
13081302 // Super POM default paths
@@ -1313,17 +1307,17 @@ private boolean hasOnlySuperPomDefaults(List<Resource> resources, Path baseDir,
13131307 .resolve ("resources-filtered" )
13141308 .toString ();
13151309
1316- // Check if all resources are Super POM defaults
1310+ // Check if any resource differs from Super POM defaults
13171311 for (Resource resource : resources ) {
13181312 String resourceDir = resource .getDirectory ();
13191313 if (resourceDir != null && !resourceDir .equals (defaultPath ) && !resourceDir .equals (defaultFilteredPath )) {
1320- // Found a non-default resource
1321- return false ;
1314+ // Found an explicit legacy resource
1315+ return true ;
13221316 }
13231317 }
13241318
1325- logger .debug ("Detected only Super POM default resources for scope: {}" , scope );
1326- return true ;
1319+ logger .debug ("Only Super POM default resources found for scope: {}" , scope );
1320+ return false ;
13271321 }
13281322
13291323 private Model injectLifecycleBindings (
0 commit comments