Pergunta

We are developing modular application where we want to use common template for each ERP module. Created own archetype inspired by maven. Finally we are able to deployed it own repository as usually able to generate project by own archetype.

  1. Where is we have to register lots files into archetype.xml, this is the break point for me. Because we are not interested to register lots of files into archetype.xml manually as it is time consuming matter.

  2. archetype.xml file where I could register sources, resources, testSources, testResources. In this situation How do i could register another custom directory?

  3. Although archetype-metadata.xml we registered fileSets and requiredProperties but no effect on generating project.

After deployed into maven repository archetype jar file inspected by me. and all the sources resources and custom directory found on jar entry. but with out registering them archetype.xml we are unable to get them inside generated project. In this situation our expected solution as following:

  1. Sort command/regex to copy/generate all the sources and resources
  2. Sort command/regex to copy/generate all the content of custom directory
  3. or archetype.xml auto generator for specific directory/sources/resources
Foi útil?

Solução

If you are new to maven archetype. do not worry. I would like to suggest you to create your archetype from existing maven project which one standard for archetype template. delete unnecessary files and folders. Just go to your project directory by cli. just run following command:

your-maven-project>mvn archetype:create-from-project
your-maven-project>cd target\generated-sources\archetype
...urces\archetype>mvn clean deploy

do not feel doubt about mvn archetype:create-from-project actually its the magic command to generate archetype. you may customize generated archetype as your demand by googling. Now generate project by your own archetype

...urces\archetype>cd your-workspace-dir
your-workspace-dir>mvn archetype:generate -DarchetypeGroupId=<archetypeGroupId> -DarchetypeArtifactId=<archetypeArtifactId> -DarchetypeVersion=<archetypeVersion>

That's all. enjoy your own archetype.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top