[英]Chaning default class name in Maven archetype:generate
Is there a way to set up default class name in Maven? 有没有办法在Maven中设置默认的类名?
I'm creating the new project with this command: 我正在使用以下命令创建新项目:
mvn -B archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=path.to.project \
-DartifactId=ProjectName
I get this structure of files: 我得到文件的这种结构:
ProjectName
|---src
| |--main
| | |----java
| | |----path
| | |-----to
| | |----project
| | |-------App.java
| |
| |--test
| |----java
| |----path
| |-----to
| |----project
| |-------AppTest.java
|---pom.xml
I want to create app with different default name. 我想使用其他默认名称创建应用。 Let's say, to replace
App.java
with NewAppName.java
and AppTest.java
with NewAppNameTest.java
. 比方说,以取代
App.java
与NewAppName.java
和AppTest.java
与NewAppNameTest.java
。
Is there a way to modify my command to get desired outcome? 有没有办法修改我的命令以获得所需的结果?
No, you can't. 不,你不能。
But you can write your own Archetypes, naming the default class file name: NewAppName.java in your project. 但是您可以编写自己的原型,在项目中命名默认的类文件名: NewAppName.java 。
reference: 参考:
http://maven.apache.org/guides/mini/guide-creating-archetypes.html http://maven.apache.org/guides/mini/guide-creating-archetypes.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.