Le lundi 17 juillet 2023, 22:49:16 CEST Slawomir Jaranowski a écrit :
> Hi
> 
> Please try a never version of Maven and m-resources-p
> Maven 3.3.9 is EOL - https://maven.apache.org/docs/history.html
> 
> m-resources-p has no parameter "resources"
m-resources-p has a resources parameter
https://github.com/apache/maven-resources-plugin/blob/master/src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java#L77

but as it is marked read-only, you're right that it's not documented, as it's 
not expected to be configured in a pom.xml
https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html

And if configured, as the user expects, it should fail instead of trying to 
configure.

@Nikos on your strange behaviour change detected in Maven 3.3.9, perhaps it's a 
consequence of https://issues.apache.org/jira/browse/MNG-5440
But again, given you're not supposed to configure this read-only parameter, 
this is an invalid usage

With Maven 3.9, you should get a warning when trying to configure:
https://issues.apache.org/jira/browse/MNG-7464

And in the future, I suppose we should switch from warning to fail.
But given it was not enforced since early 3.0, we need to move step by step to 
let users detect when they use a read-only parameter (sometimes, it has been 
useful...)

Regards,

Hervé

> 
> You should use resource configuration on project level not plugin
> configuration, like in example:
> https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exc
> lude.html
> niedz., 16 lip 2023 o 17:19 Nikos Dragazis <dragaz...@gmail.com> napisał(a):
> > 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