Author: svn-site-role
Date: Sat Oct 18 13:36:52 2025
New Revision: 1929214

Log:
Site checkin for project Apache Maven Site

Modified:
   maven/website/content/guides/mini/guide-migration-to-mvn4.html
   maven/website/content/whatsnewinmaven4.html

Modified: maven/website/content/guides/mini/guide-migration-to-mvn4.html
==============================================================================
--- maven/website/content/guides/mini/guide-migration-to-mvn4.html      Sat Oct 
18 12:31:09 2025        (r1929213)
+++ maven/website/content/guides/mini/guide-migration-to-mvn4.html      Sat Oct 
18 13:36:52 2025        (r1929214)
@@ -230,7 +230,8 @@ We plan to create a separate guide for t
 <li><a href="#Automatic_versioning_in_multi_subprojects_setups">Automatic 
versioning in multi subprojects setups</a></li>
 <li><a href="#CI-friendly_variables_without_flatten-maven-plugin">CI-friendly 
variables without flatten-maven-plugin</a></li>
 <li><a href="#Using_BOM_packaging">Using BOM packaging</a></li></ul></li>
-<li><a href="#Use_the_new_all_and_each_life_cycle_phases">Use the new all and 
each life cycle phases</a></li></ul></li></ul>
+<li><a href="#Use_the_new_all_and_each_life_cycle_phases">Use the new all and 
each life cycle phases</a></li>
+<li><a href="#New_way_to_declare_source_directories">New way to declare source 
directories</a></li></ul></li></ul>
 </section><section><a id="Prerequisites"></a>
 <h2>Prerequisites</h2>
 <p>This guide assumes that your environment and project meets the following 
prerequisites.
@@ -471,7 +472,36 @@ compatible consumer POM during the build
 <h3>Use the new <code>all</code> and <code>each</code> life cycle phases</h3>
 <p>Maven 4 introduces several new <a 
href="/ref/4-LATEST/maven-impl-modules/maven-core/lifecycles.html">lifecycle 
phases</a> &#x2014; <code>all</code>, <code>each</code>, 
<code>before:all</code>, <code>after:all</code>, <code>before:each</code>, and 
<code>after:each</code>.
 They give users finer control over plugin execution, particularly in 
multi-project and concurrent builds.
-If you want to execute a plugin before/after all or each of your 
(sub-)projects, consider to use them.</p></section></section></section>        
</main>
+If you want to execute a plugin before/after all or each of your 
(sub-)projects, consider to use them.</p></section><section><a 
id="New_way_to_declare_source_directories"></a>
+<h3>New way to declare source directories</h3>
+<p>Maven 3 has two explicitly named XML elements 
(<code>&lt;sourceDirectory&gt;</code> and 
<code>&lt;testSourceDirectory&gt;</code>) to declare the root directories of 
source code, as shown below:</p>
+
+<pre class="prettyprint linenums"><code class="language-xml">&lt;project&gt;
+  &lt;build&gt;
+    &lt;sourceDirectory&gt;my-custom-dir/foo&lt;/sourceDirectory&gt;
+    &lt;testSourceDirectory&gt;my-custom-dir/bar&lt;/testSourceDirectory&gt;
+  &lt;/build&gt;
+&lt;/project&gt;
+</code></pre>
+<p>Maven 4 introduces the new <code>&lt;sources&gt;</code> element for this.
+This makes source directory declarations more flexible for future improvements.
+When migrate to Maven 4, you should use the new element.</p>
+
+<pre class="prettyprint linenums"><code class="language-xml">&lt;project&gt;
+  &lt;build&gt;
+    &lt;sources&gt;
+      &lt;source&gt;
+        &lt;scope&gt;main&lt;/scope&gt;
+        &lt;directory&gt;my-custom-dir/foo&lt;/directory&gt;
+      &lt;/source&gt;
+      &lt;source&gt;
+        &lt;scope&gt;test&lt;/scope&gt;
+        &lt;directory&gt;my-custom-dir/bar&lt;/directory&gt;
+      &lt;/source&gt;
+    &lt;/sources&gt;
+  &lt;/build&gt;
+&lt;/project&gt;
+</code></pre></section></section></section>        </main>
       </div>
     </div>
     <hr/>

Modified: maven/website/content/whatsnewinmaven4.html
==============================================================================
--- maven/website/content/whatsnewinmaven4.html Sat Oct 18 12:31:09 2025        
(r1929213)
+++ maven/website/content/whatsnewinmaven4.html Sat Oct 18 13:36:52 2025        
(r1929214)
@@ -213,6 +213,7 @@ Maven 4 prepares for this and more.</p>
 <li><a href="#New_packaging_type.3A_bom">New packaging type: bom</a></li>
 <li><a href="#Comparing_build_POM_and_consumer_POM">Comparing build POM and 
consumer POM</a></li>
 <li><a href="#Declaring_the_root_directory_and_directory_properties">Declaring 
the root directory and directory properties</a></li>
+<li><a href="#New_way_to_declare_source_directories">New way to declare source 
directories</a></li>
 <li><a href="#Alternate_POM_syntaxes">Alternate POM syntaxes</a></li></ul></li>
 <li><a href="#Improvements_for_subprojects">Improvements for subprojects</a>
 <ul>
@@ -414,7 +415,37 @@ files and will always have a value.</p>
 <p><strong>Note:</strong> In the past, some people &#x201c;hacked&#x201d; 
workarounds for the <code>rootDirectory</code> properties, mostly by using 
internal
 properties.
 Starting with Maven 4 those properties were removed or marked as deprecated.
-See JIRA issue <a href="https://issues.apache.org/jira/browse/MNG-7038"; 
class="externalLink">MNG-7038</a> and the related <a 
href="https://github.com/apache/maven/pull/1061"; class="externalLink">Pull 
Request for MNG-7038</a> for more information.</p></section><section><a 
id="Alternate_POM_syntaxes"></a>
+See JIRA issue <a href="https://issues.apache.org/jira/browse/MNG-7038"; 
class="externalLink">MNG-7038</a> and the related <a 
href="https://github.com/apache/maven/pull/1061"; class="externalLink">Pull 
Request for MNG-7038</a> for more information.</p></section><section><a 
id="New_way_to_declare_source_directories"></a>
+<h3>New way to declare source directories</h3>
+<p>Maven 3 has two explicitly named XML elements 
(<code>&lt;sourceDirectory&gt;</code> and 
<code>&lt;testSourceDirectory&gt;</code>) to declare the root directories of 
source code, as shown below:</p>
+
+<pre class="prettyprint linenums"><code class="language-xml">&lt;project&gt;
+  &lt;build&gt;
+    &lt;sourceDirectory&gt;my-custom-dir/foo&lt;/sourceDirectory&gt;
+    &lt;testSourceDirectory&gt;my-custom-dir/bar&lt;/testSourceDirectory&gt;
+  &lt;/build&gt;
+&lt;/project&gt;
+</code></pre>
+<p>Maven 4 introduces the new <code>&lt;sources&gt;</code> element for this.
+The <code>&lt;source&gt;</code> element can be repeated, thus allowing 
multiple source directories without the need to resort to external plugins.
+It also provides a unified way to declare include/exclude filters, makes 
easier to set up projects targeting multi Java releases, and enables module 
source hierarchy.
+The documentation of the Maven Compiler Plugin gives some examples.</p>
+
+<pre class="prettyprint linenums"><code class="language-xml">&lt;project&gt;
+  &lt;build&gt;
+    &lt;sources&gt;
+      &lt;source&gt;
+        &lt;scope&gt;main&lt;/scope&gt;
+        &lt;directory&gt;my-custom-dir/foo&lt;/directory&gt;
+      &lt;/source&gt;
+      &lt;source&gt;
+        &lt;scope&gt;test&lt;/scope&gt;
+        &lt;directory&gt;my-custom-dir/bar&lt;/directory&gt;
+      &lt;/source&gt;
+    &lt;/sources&gt;
+  &lt;/build&gt;
+&lt;/project&gt;
+</code></pre></section><section><a id="Alternate_POM_syntaxes"></a>
 <h3>Alternate POM syntaxes</h3>
 <p>While the syntax for the 4.0.0 consumer POM is set in stone, the build POM 
should be able to evolve.
 This includes allowing the use of alternate syntaxes by having Maven 4 provide 
a ModelParser SPI (<a href="https://issues.apache.org/jira/browse/MNG-7836"; 
class="externalLink">MNG-7836</a>),

Reply via email to