Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import maven archetypes from GitHub

I want to start a new Drop-Wizard project. There is a maven archetype specified in the DW github (here) . But i don't know how to import it into my Intellij Idea's add Archtype option. Being specific, which link i have to provide in the Repository field. Any help would be appreciated.

like image 845
Manu Viswam Avatar asked Feb 20 '14 07:02

Manu Viswam


People also ask

Where are Maven archetypes stored?

The metadata about an archetype is stored in the archetype-metadata. xml file located in the directory META-INF/maven of its JAR file, see the reference documentation. The metadata file stores the additional properties, with corresponding default values. It also stores the project's generated files in filesets.

Which Maven plugin is used for archetype generation?

The Archetype Plugin allows the user to create a Maven project from an existing template called an archetype. It also allows the user to create an archetype from an existing project. This plugin requires Java 7.


2 Answers

Since the dropwizard archetypes are not available in maven central repository you have to:

  • Clone the dropwizard github forked project by niktelford:
    $ git clone [email protected]:nicktelford/dropwizard.git
  • Checkout the feature branch:
    $ git checkout feature/maven-archetypes
  • Move to dropwizard-archetypes module folder:
    $ cd dropwizard/dropwizard-archetypes
  • Install the dropwizard archetypes to your local repository:
    $ mvn install (The archetype samples are then added to local repository under $LOCAL_REPO/io/dropwizard/archetypes/)
  • Make the dropwizard-create script executable:
    $ cd target/classes
    $ chmod +x dropwizard-create
  • Create your project sample:
    $ ./dropwizard-create com.sample sample

Here you have your project generated then you can import it into Intellij IDEA as a maven project.

like image 62
tmarwen Avatar answered Sep 27 '22 22:09

tmarwen


Currently, to create a Dropwizard project from Maven archetype using IntelliJ IDEA one should select File>New>Project from menu. Then, in the dialog it is necessary to select Maven on the left-hand side, check Create from archetype at the top and press the Add Archetype button.

New project IDEA

After that in a dialog that appears

Dropwizard Archetype

one should enter:

  • GroupId:io.dropwizard.archetypes
  • ArtifactId:java-simple
  • Version:0.8.2

The information about the latest Dropwizard version can be obtained here.

After the aforementioned actions are completed, the desired archetype appears in the list. IDEA archetype list

Then one should press Next an fill the project's artifact and group ids and press Next. For this particular archetype it is necessary that a property called name should be added which is later used to produce names of application and configuration classes.

Add name property

After pressing Next and Finish, one can see a newly created project.

Dropwizard project

Alternatively, one could create a project using a Command Line Interface as described here, and then import the project into IDEA.

Update: Added a youtube video.

like image 33
javaeeeee Avatar answered Sep 27 '22 21:09

javaeeeee