从yaml文件中获取值到pom.xml中 [英] Get values from a yaml file into pom.xml

查看:1228
本文介绍了从yaml文件中获取值到pom.xml中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找答案,我看到人们试图将pom.xml中的值获取到yml文件中,但反之则没有.

Ive been searching for an answer to this and I see people trying to get values from a pom.xml into a yml file but not the other way around.

说我有plugin.yml

Say I have plugin.yml

main: main
name: CustomPlugin
version: 0.03
author: Me

如何将"version"的值添加到pom.xml中,这样我就不必同时更新yml和pom.xml中的版本.请注意,我不想从pom.xml转到yml.

How would I get the value of "version" into my pom.xml so that I don't have to update version in both the yml and pom.xml. Note I DO NOT want to go from pom.xml to yml.

我在想像这样的事情,但是我对Maven和Pom的了解还不足以确保: pom.xml

I'm thinking something like this but I don't know enough about maven and pom's to be sure: pom.xml

<property file="src/plugin.yml" prefix="plugin"/>

然后使用$ {plugin.version}?

and then use ${plugin.version}?

推荐答案

您应将plugin.yml文件放入src/main/resources并在 查看全文

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