Creating Maven Archetype: is there a way to specify a default groupId

泪湿孤枕 提交于 2020-01-13 03:57:20

问题


I have created a maven archetype using create-from-project. Is there a way to specify a default groupId?

This archetype is for internal use only, default groupId would save some keystrokes.

Thanks.


回答1:


You can do this by specifying a propertyFile

This property file may contains few properties including default groupId. So something like this (in a file named something.properties):

groupId=com.company

and to create the archetype

mvn archetype:create-from-project -Darchetype.properties=../something.properties

another example here




回答2:


If you want to use a "default" groupId because of company conventions, you can define it directly in the pom.xml in the archetype-resources directory (just replace the ${groupId} with your desired value. So it doesn't matter what the user of the archetype specifies.



来源:https://stackoverflow.com/questions/14879455/creating-maven-archetype-is-there-a-way-to-specify-a-default-groupid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!