Maven 3 not blocking setting read-only parameters is a known limitation
https://issues.apache.org/jira/browse/MNG-5001

in your case where you find a different behaviour between different Maven 3 
releases, I imagine it's an additional side effect of this parameter not really 
being expected to be configured like this

Perhaps recent "plugin verification" checks do check this: did you try with 
Maven 3.9.3?

Regards,

Hervé

Le dimanche 16 juillet 2023, 17:19:02 CEST Nikos Dragazis a écrit :
> 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





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to