Showing posts with label maven. Show all posts
Showing posts with label maven. Show all posts

Saturday, February 05, 2011

Debug maven application with jetty plugin

Have the jetty plugin configured.
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.12</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8888</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>

After that It’s time to configure eclipse for debugging the web app by selecting the Run > Debug … from the menu
# Set Main Class to "org.codehaus.classworlds.Launcher"

Go to the argument tab:
# Set Program arguments to "jetty:run"
# Set VM arguments to "-Xmx512M -Dclassworlds.conf=[MAVEN_HOME]/bin/m2.conf -Dmaven.home=[MAVEN_HOME]"
(Replace MAVEN_HOME with the location of maven on your system)

Go to the classpath tab:
# remove the application from the user entries
# add the "[MAVEN_HOME]/lib/classworlds.jar" to the user entries. in case if the classworlds.jar have version number in the name, please include. Essentially we need to add the correct jar to the classpath

Go to the source tab:
# add the current project to debug

Now you can start debugging your application like you do it always

It is very interesting to set the –o option to the maven command in order to accelerate the fix/debug process.

Wednesday, December 31, 2008

Maven

Maven comes really handly when it comes to managing project structure, building code etc. Its flexible dependency management is the best feature I go for.

In case if you want to start with maven, and looking for a starting point, Download latest maven (comes as a zip file, unzip it) and set your PATH environment variable to bin folder.
Now type "mvn archetype:generate" it lists out possible project types available. the follow up steps are self explanatory.

If you are looking for a specific project type (like a simple web application with springs configured etc), you might need to google for it. With little bit of effort you will get to find proper archtypes.

One problem I faced with maven POM (Project Object Model) files is with specific dependencies (jar files) which are not at all available on internet. I resolve them by creating similar structure locally and getting the near best possible jar file (yes I create folder strtucture, file name as required).