如何在 Maven 中以编程方式获取资源编码
我正在编写一个 Maven 插件,我想操作一些资源文件。
为了实现这个目标,我想采用使用 maven-resource-plugin 指定的编码:如何以编程方式访问此编码?
I am writing a maven plugin and I would like to manipulate some resource files.
To achieve this goal, I would like to take the encoding specified using maven-resource-plugin : how can I programmatically access this encoding ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,访问其他插件配置是一个坏主意。相反,您可以使用 相同的表达式 作为 Maven 资源插件正在使用 pom.xml 中的属性替换。
但如果你真的想这样做,你将必须获取 Maven 项目实例,找到资源插件,然后解释其配置,同时考虑所有父项目。我不相信 Maven 提供了任何简单的方法来处理这个问题。
Generally it is a bad idea to access other plugin configuration. Instead you canuse the same expression as Maven resource plugin is using and use property substitution in pom.xml.
But if you really want to do that, you will have to get the Maven project instance, find resource plugin and then interpret its configuration, taking into account all parent projects as well. I don't believe Maven provides any easy way to handle that.