Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>classic-sources-explicit-legacy-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<sources>
<!-- Classic (non-modular) source - no module attribute -->
<source>
<scope>main</scope>
<lang>java</lang>
<directory>src/main/java</directory>
</source>
<source>
<scope>test</scope>
<lang>java</lang>
<directory>src/test/java</directory>
</source>
</sources>
<!-- Explicit legacy directories that conflict with <sources> - should trigger ERROR (AC9) -->
<sourceDirectory>src/legacy/main/java</sourceDirectory>
<testSourceDirectory>src/legacy/test/java</testSourceDirectory>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tests duplicate handling with the enabled discriminator.

Expected behavior:
- Same (lang, scope, module, directory) with enabled=true appearing twice should trigger a WARNING
- Same identity with enabled=false is harmless (explicitly disabled)
- First enabled=true entry wins and defines the effective configuration
-->
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>duplicate-enabled-sources-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<sources>
<!-- First enabled source for module (this should win) -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>com.example.dup</module>
<enabled>true</enabled>
</source>
<!-- Duplicate enabled source for same module (implicit directory) - should trigger WARNING -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>com.example.dup</module>
<enabled>true</enabled>
</source>
<!-- Disabled source for same module - this is harmless -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>com.example.dup</module>
<enabled>false</enabled>
</source>
<!-- Different module - should be added normally -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>com.example.other</module>
</source>
<!-- Test scope duplicate scenario -->
<source>
<scope>test</scope>
<lang>java</lang>
<module>com.example.dup</module>
<enabled>true</enabled>
</source>
<source>
<scope>test</scope>
<lang>java</lang>
<module>com.example.dup</module>
<enabled>true</enabled>
</source>
</sources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tests AC8 scenario 2: Modular project with Java in <sources> for MAIN scope
and explicit legacy <sourceDirectory> that differs from default.

Expected behavior:
- ERROR for <sourceDirectory> (modular project, <sources> has Java for MAIN)
- Modular Java sources are used, not legacy
-->
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>modular-java-with-explicit-source-dir-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<!-- Explicit legacy sourceDirectory - triggers ERROR (AC8) -->
<sourceDirectory>src/custom/main/java</sourceDirectory>

<sources>
<!-- Modular main Java source -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>org.foo.app</module>
</source>
</sources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tests AC8 scenario 5: Modular project with NO Java in <sources> for TEST scope
and explicit legacy <testSourceDirectory> that differs from default.

Expected behavior:
- ERROR for <testSourceDirectory> (modular project, no AC9 fallback)
- No test Java sources (legacy rejected, none in <sources>)
-->
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>modular-no-test-java-with-explicit-test-source-dir-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<!-- Explicit legacy testSourceDirectory - triggers ERROR (AC8, no AC9 fallback for modular) -->
<testSourceDirectory>src/custom/test/java</testSourceDirectory>

<sources>
<!-- Modular main Java sources only - no test Java -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>org.foo.app</module>
</source>
<!-- No test Java sources in <sources> -->
</sources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tests AC8: Modular project with only resources in <sources> and physical default legacy directory.

Expected behavior:
- Modular resources from <sources> are processed
- Physical src/main/java and src/test/java directories exist but would be ignored
- ERROR is raised because physical default directories exist (AC8 physical presence check)
- Unlike non-modular projects (AC9), modular projects cannot use legacy directories as fallback

Note: The src/main/java and src/test/java directories are created empty to trigger
the physical presence check.
-->
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>modular-resources-only-with-physical-legacy-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<!-- No explicit sourceDirectory/testSourceDirectory - uses Super POM defaults -->
<!-- But physical src/main/java and src/test/java directories exist -->

<sources>
<!-- Only modular resources - no Java sources -->
<source>
<scope>main</scope>
<lang>resources</lang>
<module>org.example.app</module>
</source>
<source>
<scope>test</scope>
<lang>resources</lang>
<module>org.example.app</module>
</source>
</sources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>modular-sources-explicit-resources-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<sources>
<!-- Module A - main java -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>org.foo.moduleA</module>
</source>
<!-- Module B - main java -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>org.foo.moduleB</module>
</source>
</sources>
<!-- Legacy resources are IGNORED when modular sources are configured - a warning should be issued -->
<resources>
<resource>
<directory>src/custom/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/custom/test-resources</directory>
</testResource>
</testResources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>modular-sources-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<sources>
<!-- Module A - main java -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>org.foo.moduleA</module>
</source>
<!-- Module A - test java -->
<source>
<scope>test</scope>
<lang>java</lang>
<module>org.foo.moduleA</module>
</source>
<!-- Module B - main java -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>org.foo.moduleB</module>
</source>
<!-- Module B - test java -->
<source>
<scope>test</scope>
<lang>java</lang>
<module>org.foo.moduleB</module>
</source>
</sources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tests AC8: Modular project with physical default legacy directory.

Expected behavior:
- Modular Java sources from <sources> are processed
- Physical src/main/java and src/test/java directories exist but would be ignored
- ERROR is raised because physical default directories exist (AC8 physical presence check)

Note: The src/main/java and src/test/java directories are created empty to trigger
the physical presence check.
-->
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>modular-with-physical-legacy-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<!-- No explicit sourceDirectory/testSourceDirectory - uses Super POM defaults -->
<!-- But physical src/main/java and src/test/java directories exist -->

<sources>
<!-- Modular Java sources -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>org.example.app</module>
</source>
<source>
<scope>test</scope>
<lang>java</lang>
<module>org.example.app</module>
</source>
</sources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Tests multiple source directories for the same (lang, scope, module) combination.
This is a valid use case: users may have generated sources alongside regular sources.

Expected behavior:
- Both directories should be added as source roots
- Both should have the same module attribute
- The compiler will merge sources from both directories into the same output
-->
<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
<modelVersion>4.1.0</modelVersion>

<groupId>org.apache.maven.tests</groupId>
<artifactId>multiple-directories-same-module-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
<sources>
<!-- Primary Java source for module (uses implicit directory) -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>com.example.app</module>
</source>
<!-- Generated sources for the same module (explicit directory) -->
<source>
<scope>main</scope>
<lang>java</lang>
<module>com.example.app</module>
<directory>target/generated-sources/com.example.app/java</directory>
</source>
<!-- Test sources for module -->
<source>
<scope>test</scope>
<lang>java</lang>
<module>com.example.app</module>
</source>
<!-- Generated test sources -->
<source>
<scope>test</scope>
<lang>java</lang>
<module>com.example.app</module>
<directory>target/generated-test-sources/com.example.app/java</directory>
</source>
</sources>
</build>
</project>
Loading