User login

Error message

Notice: Undefined offset: 1 in nice_menus_block_view() (line 306 of /var/www/thot-soft.com/web/sites/all/modules/nice_menus/nice_menus.module).

Generating single- or multi-module projects with Maven3

The current blog issue is about how to generate single- or multi-module projects with Maven3 by hand and not using some tool, like Netbeans.

Generating single module projects

To generate a single module project just execute following command:

mvn  archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1 -DgroupId=com.thotsoft -DartifactId=rendezes -Dpackage=com.thotsoft.rendezes -Dversion=1.0-SNAPSHOT

In order to customize for your project, you should changed the parts marked with red.

Issuing this command will generate the single module project.

Generating multi-module project

In case we are preparing a JEE application, the single module project is not enough. We will need a project where we will have to handle several modules in one project. For this purpose the multi-modules project is perfect. Let's generate it!

The following modules will be generated:

 

  • EJB module - module for implementing business functionalities - the backend
  • WEB module - module for implementing the view - the frontend
  • EAR module - module for assemblilng Enteprise ARchive file

Beside this, the main, parent pom.xml will be generated in the main directory. The command line command for generating the project is following:

mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=ejb-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=com.thotsoft -DartifactId=test-multimodule-project-ejb -Dversion=1.0-SNAPSHOT -Dbasedir=C:\\work\\test-multimodule-project -Darchetype.interactive=false --batch-mode archetype:generate

The emphasized parts with red should be replaced with your project details.

After running the command above, the following directory/file structure is created:

test-multimodule-project/

 --/test-multimodul-project-ear

 --/test-multimodul-project-ejb

 --/test-multimodul-project-web

 --/pom.xml

In next blog entry I will discuss how to add a new module to the existing multi-module project.

If any question raises, please comment it or send question to magyar@mail.thot-soft.com.

English

Blog Authors

User Blog History