[
https://issues.apache.org/jira/browse/MRESOURCES-293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17684956#comment-17684956
]
Delany commented on MRESOURCES-293:
-----------------------------------
{quote}With a sufficient number of users of an API,
it does not matter what you promise in the contract:
all observable behaviors of your system
will be depended on by somebody.
Hyrum's Law
{quote}
In the end it was a combination of factors that led to me turn off the
default-resources execution and create my own discrete executions.
For one thing, the build/resources element is shared among multiple resource
mojo executions so i couldn't use it.
To answer the question why a resource was missing from a JAR I had to consider
(as a complete novice to Maven)
* multiple build/resources/resource elements in one pom
* inherited build/resources configuration via help-plugin effective-pom
* multiple and often competing include/exclude filters
* mistake in the glob patterns
* filters are laissez-faire/passthru style - no match does not fail the build,
and since the logs never show filename I had to add a guard in the form of the
verifications-plugin which checked resources were actually copied
*
[https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#outputDirectory]
*
[https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#overwrite]
*
[https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#usebuildfilters]
* did the resources plugin override a generated resource from
jaxb/jaxws/xmlbeans. This can get really tricky especially with both jaxb and
jaxws plugins
* before sortpom, moving config around could result in a change in plugin
execution order, and before I discovered buildplan-plugin I wouldn't have known
* resources were needed from other modules. They were retrieved using ../
syntax. Eventually I replaced this with maven-remote-resources-plugin
No wonder I got this job, no one else wanted it! How many plugins I mention?!
There are too many ways resource copying can go wrong and too few ways to check
that it works. I went as far as providing a [https://diffoscope.org/] view of
all the unpacked artefacts.
So no thanks build/resources. It looked like a cheat so I threw it out and
achieved clarity and consistency in the configuration. Today I know exactly
what gets copied when and where - no more magic.
Moving forward though - I'm fine with this mojo warning about read-only. I see
the intention - its all obvious in retrospect.
For now
{code:java}
-Dorg.slf4j.simpleLogger.log.org.apache.maven.plugin.internal.ReadOnlyPluginParametersValidator=error{code}
For later I could try use copy-resources mojo instead.
Perhaps in addition to *Required* and *Optional* parameters the documentation
could mention *Prohibited* parameters?
> 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)