避免替换表达式原型:create-from-project

发布于 2024-10-10 05:43:51 字数 522 浏览 0 评论 0原文

嘿, 有人可以告诉我在通过 archetype:create-from-project 创建原型时如何避免替换项目中的某些表达式吗?

例如

,如果程序员从版本 1.0 的项目创建原型,则它会用 ${version} 替换项目中所有出现的“1.0”表达式1.0< /code> ,然后例如 xml 文件的标头

更改为

<?xml version="1.0-SNAPSHOT"?> 

.... 因为有 在原型资源中,用户输入 1.0-SNAPSHOT 作为项目版本

另外,从原型创建项目时是否可以提供更多参数?除了 groupId、artifactId、package 和 version 之外?

Hey,
could please anybody tell me how to avoid substitution of some expressions in a project when creating an archetype from it via archetype:create-from-project ?

for instance it substitutes all appearances of "1.0" expressions in the project with ${version}

if programmer creates the archetype from project of verion 1.0 <version>1.0</version> , then for instance header of an xml file

<?xml version="1.0"?>

changes to

<?xml version="1.0-SNAPSHOT"?> 

.... because there was <?xml version="${version}"?> in the archetype resources and users entered 1.0-SNAPSHOT as a project version

Also, is it possible to supply more arguments when creating project from the archetype? In addition to groupId, artifactId, package and version ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一梦浮鱼 2024-10-17 05:43:51

您可以将 -Darchetype.filteredExtentions=extension1,extension2,... 添加到您的 mvn 命令中,以告诉 maven 在其速度替换中包含哪些文件扩展名。如果您列出所有文件扩展名并省略 xml,它应该会跳过它们。如果 xml 是项目中唯一的文件类型,则可以执行 -Darchetype.filteredExtentions

You can add -Darchetype.filteredExtentions=extension1,extension2,... to your mvn command to tell maven which file extensions to include in its velocity substitutions. If you make a list of all of your file extensions and leave off xml, it should skip over them. You can do -Darchetype.filteredExtentions if xml is the only file type in your project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文