Hobione's Weblog

Living & Breathing in Web 2.0 Era

Maven Jetty-plugin and IntelliJ IDEA

Scenario: You have a maven project and you want to tie with IntelliJ 9 to make it part of IDE built-in commands instead of using command line interface.

Pre-requisite: Need to read Maven Jetty-Plugin User Guide.

Solution: Here is a skeleton project hierarchy:
BenchStock
You also should have a pom.xml file directly under the project.

Now, open up the IntelliJ. Go to File –> Open Project and choose the pom.xml file to bring the project into Intellij and here how it looks. Notice, Idea has created few extraneous files like .impl, .ipr and .iws.
Project in Intellij

How to configure Run command?
In the IDEA, go to Run –> Edit Configurations
You see the “Run/Debug Configurations” window. Under Parameters tab choose the directory and set the goal command:
Run/Debug Configurations

Under Runner tab, set VM Parameters to these: (You may not need to sett all these)

-Xms512m
-Xmx512m
-Dcron.properties="c:\MySDP\cron.properties"
-Dcrowd.properties="C:\Documents
and
Settings\hobee
haq\My
Documents\buildLocal\itrsbenchstock\src\etc\resources\crowd.properties"
-Dlogin.jsp="C:\Documents
and
Settings\hobee
haq\My
Documents\buildLocal\itrsbenchstock\src\webapp\pages\login.jsp"

Runner Tab

Application is ready to run by click the play button.
Play Button
Here is the proof:
Jetty Run

How to configure Build?
Build

It should shows the Build option to the IDEA drop down. Choose the Build option and click the play button.
Build with Play Button

How to configure clean?
Clean Project from target directory

How to configure scm bootstrap?
SCM BootStrap

Here is the final configured list looks like:
Configured List

Hopefully, this post will help me to remember and configure all my future apps with maven jetty-plugin in IntelliJ Idea.

September 22, 2010 Posted by | Maven | Leave a comment