0

I'm creating a maven plugin and I want to allow user to create a project by specifying some details required by my plugin. I understand that when creating a project with simple mvn archetype:generate it points to the maven default archtype catalog which asks for groupId, artifactId, etc.

The question here is how do I create my own custom catalog so that I can make creation of a project interactive for the customer.

e.g. When a client points to my archetype catalog like

mvn archetype:generate -DarchetypeCatalog=http://abc.com/archetype-catalog.xml

he should be able to see the following,

Define value for project_home: C:/XYZ
Define value for server-url: http://localhost:8080/
Define value for groupId: : com.xyz
Define value for artifactId: : sample
Define value for version:  1.0-SNAPSHOT: :
Define value for package:  com.xyz
Confirm properties configuration:
project-home: C:/XYZ
server-url: http://localhost:8080/
groupId: com.xyz
artifactId: sample
version: 1.0-SNAPSHOT
package: com.xyz
 Y: :

Any pointer or some link on web would also be helpful.

4

1 回答 1

1

我以 pustefix-archetype-basic 为例,在 META-INF/maven/archetype-metadata.xml 中有以下代码:

<requiredProperties>
    <requiredProperty key="groupId">
      <defaultValue>mytld.myorg</defaultValue>
    </requiredProperty>
    <requiredProperty key="artifactId">
      <defaultValue>myapp</defaultValue>
    </requiredProperty>
    <requiredProperty key="version">
      <defaultValue>1.0-SNAPSHOT</defaultValue>
    </requiredProperty>
    <requiredProperty key="package">
      <defaultValue>mytld.myorg.myapp</defaultValue>
    </requiredProperty>
    <requiredProperty key="pustefixVersion">
      <defaultValue>0.18.30</defaultValue>
    </requiredProperty>
  </requiredProperties>

尝试添加您的属性:)

于 2012-11-08T11:12:56.630 回答