Maven原型文件名模式与下划线 [英] Maven archetype filename pattern with underscore

查看:435
本文介绍了Maven原型文件名模式与下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个Maven原型。我想生成像 project_todo_messages.properties 这样的文件,其中 todo 被过滤后的属性替换。

I'm creating a Maven archetype. I want to generate files like project_todo_messages.properties with todo replaced by a filtered property.

我在<$ c中创建了一个文件 project ___ todo ___ messages.properties 和一个过滤后的属性 todo $ c> archetype-metadata.xml 和 archetype.properties
重命名没有下划线的文件,但不包括过滤属性周围带下划线的文件。有什么想法?

I created a file project___todo___messages.properties and a filtered property todo in archetype-metadata.xml and archetype.properties. Files without underscore are renamed, but files with underscore around the filtered property are not. Any ideas?

我使用maven-archetype-plugin 2.3和org.apache.maven.archetype:archetype-packaging 2.3。

I use maven-archetype-plugin 2.3 and org.apache.maven.archetype:archetype-packaging 2.3.

其他问题:是否可以在文件名中小写过滤值,就像在 $ {todo.toLowerCase()} 的文件内容中一样?

Other question : is it possible to lowercase a filtered value in a filename like it is possible in a file content with ${todo.toLowerCase()}?

推荐答案

您可以通过添加所需属性并将默认值设置为所需的过滤器来完成这两项操作。

You can accomplish both by adding required properties with default values set to the filter you want.

对于第一种情况:

<requiredProperty key="messagePropertiesFileName">
    <defaultValue>project_${todo}_messages</defaultValue>
</requiredProperty>

将文件命名为 __ messagePropertiesFileName __。properties

对于第二种情况,添加另一个属性:

For the second case, add yet another property:

<requiredProperty key="todoLowerCase">
    <defaultValue>${todo.toLowerCase()}</defaultValue>
</requiredProperty>

在文件夹/文件名中使用 __ todoLowerCase __

Use __todoLowerCase__ in folder/file names.

这篇关于Maven原型文件名模式与下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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