使用过滤将Maven插件输出到资源文件 [英] Maven plugin output to recourse file using filtering

查看:95
本文介绍了使用过滤将Maven插件输出到资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的资源文件包含:

${project.version}
${dependency.tree}

是否可以用mvn dependency:tree -Dincludes=com.foo.bar命令输出替换(过滤)${dependency.tree}属性?

Is it possible to replace (filtering) ${dependency.tree} property with mvn dependency:tree -Dincludes=com.foo.bar command output ?

推荐答案

在这里没有简单的出路,但我认为有可能.

No easy way out here, but I think it's possible.

我会这样:

  1. dependency插件目标tree绑定到generate-resources阶段,并将其配置为将所有内容输出到某个文件(outputFile选项,请参见此处有关操作方法).这应该在pom.xml中的上一步之后进行,并绑定到generate-resources阶段.
  2. 使用resources插件+过滤实现目标.
  1. Bind dependency plugin goal tree execution to generate-resources phase and configure it to output everything to some file (outputFile option, see here).
  2. Use gmaven plugin to load this file into a dependency.tree property (see my answer here on how to do it). This should go after the previous step in pom.xml and be bound to generate-resources phase.
  3. Use resources plugin + filtering to achieve the goal.

这篇关于使用过滤将Maven插件输出到资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆