[ 
https://issues.apache.org/jira/browse/MRESOURCES-293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17691115#comment-17691115
 ] 

Peter Hicks commented on MRESOURCES-293:
----------------------------------------

For the benefit of others, I had this problem on Maven 3.9.  I didn't realise 
the resources need to go under project/build/resources in pom.xml, and I was 
specifying the whole resources tag under 
project/build/plugins/plugin/configuration for the maven-resources-plugin.

The issue was made more complex as the documentation at 
https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html
 isn't explicit that the resources tag must be directly under 'build', and not 
the plugin configuration.  Partly supporting this is a high-ranking hit on 
Google at https://www.baeldung.com/maven-resources-plugin in which section 3 
shows a configuration tag and includes the resources in the plugin 
configuration.

In summary, including this in pom.xml causes the warning:

{{<plugin>}}
{{    <groupId>org.apache.maven.plugins</groupId>}}
{{    <artifactId>maven-resources-plugin</artifactId>}}
{{    <version>${maven-resources-plugin.version}</version>}}
{{    <configuration>}}
{{        <propertiesEncoding>UTF-8</propertiesEncoding>}}
{{        <resources>}}
{{            <resource>}}
{{                <directory>${project.basedir}/common</directory>}}
{{                <includes>}}
{{                    <include>banner.txt</include>}}
{{                </includes>}}
{{                <filtering>true</filtering>}}
{{            </resource>}}
{{        </resources>}}
{{    </configuration>}}
{{</plugin>}}

The correct way to do it, which might need a documentation update to make it 
explicit, is to move the 'resources' tag up to under the 'build' tag

{{<build>}}
{{    <resources>}}
{{        <resource>}}
{{            <directory>${project.basedir}/common</directory>}}
{{            <includes>}}
{{                <include>banner.txt</include>}}
{{            </includes>}}
{{            <filtering>true</filtering>}}
{{        </resource>}}
{{    </resources>}}
{{    <plugins>}}
{{        <plugin>}}
{{            <groupId>org.apache.maven.plugins</groupId>}}
{{            <artifactId>maven-resources-plugin</artifactId>}}
{{            <version>${maven-resources-plugin.version}</version>}}
{{            <configuration>}}
{{                <propertiesEncoding>UTF-8</propertiesEncoding>}}
{{            </configuration>}}
{{        </plugin>}}
{{    </plugins>}}
{{</build>}}

> Resources should not be read-only
> ---------------------------------
>
>                 Key: MRESOURCES-293
>                 URL: https://issues.apache.org/jira/browse/MRESOURCES-293
>             Project: Maven Resources Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.0
>            Reporter: Delany
>            Priority: Major
>
> With Maven 3.9.0 I'm getting lots of these warnings
> {noformat}
> [WARNING] Parameter 'resources' is read-only, must not be used in 
> configuration{noformat}
> Clearly it shouldn't be marked read-only
> https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to