gnodet-bot commented on code in PR #1221: URL: https://github.com/apache/maven-compiler-plugin/pull/1221#discussion_r4752638297
########## src/site/markdown/examples/exclude-sources.md.vm: ########## @@ -0,0 +1,83 @@ +--- +title: Exclude Sources +author: + - Umer Hassan Butt +date: 2026-12-01 +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +# Exclude Sources + +Use the [`excludes`](../compile-mojo.html#excludes) parameter to exclude source +files or directories from main compilation. Patterns are relative to each source +root, such as `src/main/java`. Do not start patterns with `/`. + +For example, this configuration excludes all Java sources under +`src/main/java/com/example/legacy`, including its subdirectories: + +```xml +<project> + [...] + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>${project.version}</version> + <configuration> + <excludes> + <exclude>com/example/legacy/**</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> + [...] +</project> +``` + +Run `mvn compile` to compile the remaining main sources. In a multi-module build, +put this configuration in the module POM that needs the exclusion. Configuration +in a parent POM is inherited by its child modules. Review Comment: 💡 **Nit (passive voice):** "is inherited by" is passive. Consider: ```suggestion put this configuration in the module POM that needs the exclusion. Child modules inherit any configuration set in a parent POM. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
