Hi Nikos,
That goal is only intended to be configured from project.build.resources.
You can rather use
https://maven.apache.org/plugins/maven-resources-plugin/copy-resources-mojo.html

https://issues.apache.org/jira/browse/MRESOURCES-293
Delany

On Sun, 16 Jul 2023, 17:19 Nikos Dragazis, <dragaz...@gmail.com> wrote:

> Hi everyone,
>
> I'd like to expose a deviation in maven's behavior regarding readonly
> parameters in plugins. It seems that, starting from version 3.3.9, maven
> no longer ignores configuration parameters for readonly arguments.
>
> In more detail:
>
> I have a project that follows the `war` packaging lifecycle and I'd like
> to parameterize some resource files. Therefore, I tried to use the
> maven-resources-plugin with a configuration that looks like this:
> ```
> <plugin>
>    <groupId>org.apache.maven.plugins</groupId>
>    <artifactId>maven-resources-plugin</artifactId>
>    <version>2.6</version>
>    <configuration>
>      <resources>
>        <resource>
> <directory>src/main/resources/META-INF</directory>
>          <targetPath>META-INF</targetPath>
>          <filtering>true</filtering>
>          <includes>
>            <include>persistence.xml</include>
>          </includes>
>        </resource>
>        <resource>
> <directory>src/main/resources/META-INF</directory>
>          <targetPath>META-INF</targetPath>
>          <filtering>false</filtering>
>          <excludes>
>            <exclude>persistence.xml</exclude>
>          </excludes>
>        </resource>
>      </resources>
>    </configuration>
> </plugin>
> ```
> When running the `resources` goal with maven 3.3.3, I noticed that maven
> ignores the inclusion/exclusion lists from the plugin's configuration,
> i.e., the plugin copies `persistence.xml` unfiltered. However, this is
> not the case with maven 3.3.9, where it actually filters the file.
>
> Later on, I figured that the `resources` parameter is readonly for the
> `resources` goal, and it gets its default value from the build/resources
> element. So, I would expect maven to either ignore the `resources`
> parameter from the configuration of the `resources` goal (like what
> happens in maven 3.3.3), or throw an error. That said, I find the
> behavior of maven 3.3.9 unexpected.
>
> I'd love any feedback on this.
>
> Thanks,
> Nikos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to