Create New Project through wizard with maven support

Is it possible to create a New Project in IntelliJ 13.+ by using the project wizard but configuring it to use Maven instead of dowloading the libraries during project Creation?  I know you can create projects with maven archtypes.  The problem is I don't know if that project/folder structure is what I wanted.  I am kind of inexperienced with Maven.

For example I want to create a Java Project with RichFaces.  The New project wizard will want to download the libraries.  I want Maven to handle all that and for it not to download the libraries.

I hope this makes sense.

intellij-project-creation-richfaces.png

4 comments
Comment actions Permalink

Hello.

In other words, to create a project using Maven and RichFaces, and do it using project wizard? Seems that this exact way is not provided.

Probably the way to do it is like:
1. Create Maven project. If you don't know the proper archetype, then just plain pom.xml, by quickstart archetype or any.
2. Insert into this pom.xml necessary dependencies and plugins. I suspect, you need maven-war-plugin and dependency to rich faces artifacts. Anyway, you have to check some samples in rich faces documentation or anywhere.
3. Make sure IDEA has re-imported the changed pom. Web facet and IDEA module dependencies should be added.

Regards,
Alexander.

0
Comment actions Permalink

There are several ways to go...

Option 1
I know you said you didn't want to use the maven archetype... but that is the correct way to go.  If desired, you can stick with the two most basic archetypes to start with... those being org.apache.maven.archetypes:maven-archetype-quickstart and  org.apache.maven.archetypes:maven-archetype-webapp. The maven archetypes will always create a project with the "correct" directory structure and layout. If you are not familiar, maven takes a convention over configuration philosophy. So if you stay with the default conventional layout, you will have far less configuration to do. If you are new to maven, I strongly recommend you stick with the default project layout. You do not want to be figuring out how to configure custom directory structures while simultaneously learning maven basics.

You can either select the archetype in the IntelliJ IDEA wizard, or run the archetype goal via maven at the command line (see Introduction to Archetypes). If you run at the command line, afterwards, just go to File > Import Project and select the POM file.  For RichFaces, you can use a RichFace specific Archetype (see the RichFaces document Creating a Prject with Maven):


<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- The Basics -->
  <groupId>com.example</groupId>
  <artifactId>your-application-name</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>  <!-- Or for a webapp, make this "war" rather than "jar" -->
</project>

  • Create the basic directory structure (Only include the webapp directory and it sub directories if it is a webapp):
  • {project-root}
      +--src
      |   +--main
      |   |    +--java
      |   |    +--resources
      |   |    +--webapp
      |   |          +--WEB-INF
      |   |                 +--web.xml
      |   +--test
      |        +--java
      |        +--resources
      +--pom.xml
  • Import the POM into IntelliJ IDEA
    • File > Import Project
    • Select the pom.xml file
  • After importing, you can use IntelliJ IDEA to add your dependencies

  • Before doing the import in step 3, you can make a copy of the pom and directory structure and save it as a project template.

    0
    Comment actions Permalink

    I really appreciate your help and that is exactly the advice I needed.  I will give it a try and let you.

    Truly, Thanks!

    0
    Comment actions Permalink

    Thanks for confirming I wasn't doing something wrong.  I don't know if that would be a worthwhile feature.  But at least I know it wasn't an ID10-T error.

    I will try what you suggested.  Thanks.

    0

    Please sign in to leave a comment.