为原型指定原型:在命令行上生成 [英] Specify archetype for archetype:generate on command line

查看:65
本文介绍了为原型指定原型:在命令行上生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个简单的项目生成Maven原型.我使用archetype:generate,它为我提供了要生成的原型类型的列表.我很确定我想要

I'm generating a Maven archetype for a simple project. I use archetype:generate, and it gives me a list of types of archetypes to generate. I'm pretty sure I want

99: remote -> maven-archetype-quickstart (An archetype which contains a sample Maven project.)

我只能以交互方式输入"99",但我正在尝试撰写博客文章.我不想告诉我的读者在数百种选择中搜索maven-archetype-quickstart",而且我知道它并不总是第99位.

I can just enter "99" interactively, but I'm trying to write a blog post. I don't want to tell my readers "search for maven-archetype-quickstart in the hundreds of options", and I know it won't always be number 99.

那么,如何在命令行上指定要生成的原型?

So, how do I specify on the command line the archetype to generate?

(一个类似的问题讨论了使用哪种原型,但没有讨论如何使用以非交互方式指定它)

(A similar question discusses which archetype to use, but not how to specify it non-interactively)

推荐答案

您可以通过系统属性

You can provide arguments via system properties, as in:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

这篇关于为原型指定原型:在命令行上生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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