Quick Maven Archetypes and Project Setup


If we need to re-use the maven based project as base for future projects, then we can create an archetype which can generate the skeleton for the future project. It applies to both single-module and multi-module maven projects
Steps:
  1. Go to project root directory
  2. mvn archetype:create-from-project
      - This generates a target folder with generated-resource directory , find archetype-metadata.xml for the details about the file inclusions and module setup
  3. Got to target/generated-sources/archetype/ 
    mvn install 
      - This installs the current archetype into maven repo

[INFO] project created from Archetype in dir: kitchensink\target\generated-sources\archetype\target\test-classes\projects\basic\project\basic
[INFO] No post-archetype-generation goals to invoke.
[INFO]
[INFO] --- maven-install-plugin:2.5.1:install (default-install) @ kitchensink-archetype ---

 --- maven-archetype-plugin:2.2:update-local-catalog (default-update-local-catalog) @ kitchensink-archetype ---

  • Archetype gets created from above shown archetype location, this will be available in the default-update-local-catalog or local catalog

 Using the Archetype: (Eclipse)

  • New -> Maven -> Maven Projects
  • select local catalog , if nothing displays , make sure to check  "Include Snapshot Archetypes" option
  • Then click finish , project is created 

Comments

Popular posts from this blog

Hibernate queries are slow ! SQL Server's are not my type ? - Here is what you need to know!

IFTTT Service descriptions with Google Search

Detecting browser event closing in Javascript