Saturday, November 17, 2007

Debugging a web application with IntelliJ IDEA, Maven and the jetty plugin

Hi,

Today I was doing some development in the most recent build of IntelliJ IDEA (found here), and toying with it I have found a quick way to debug any web application which is built using Maven.
It is a must in my developments to use the jetty maven plugin, so I can just start the application using:

mvn jetty:run

And then edit my pages and stuff without having to restart, or deploy to external web containers. To do that you just need to declare the jetty plugin in your POM file:

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>maven-jetty-plugin</artifactId>
  <version>6.1.2</version>
  <configuration>
    <connectors>
    <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>8080</port>
      </connector>
    </connectors>
    <scanIntervalSeconds>10</scanIntervalSeconds>
  </configuration>
</plugin>

Open you project with IntelliJ IDEA (it is nice that now you can just open a maven POM as a project!), and then you can use this plugin to start the web application and start debugging right away. To do so:

  1. Create a new Run/Debug configuration (click on the drop down list on the left of the green arrow icon) and "Edit configurations".
  2. Click on the '+' (plus) button and create a new "Maven" configuration.
  3. Give it a name.
  4. In the goals section just put "jetty:run"
  5. And you are good to go!

Set some breakpoints and you can debug the web application now just clicking on the "debug" button.

Enjoy!

Thursday, May 10, 2007

Myfaces 1.2 - Implementation 100%

MyFaces 1.2 is now a reality. The TCK tests has been passed under Geronimo and now it remains the acknowledgement by Sun and the official confirmation that the tests pass. So we will have to wait a bit, but the snapshot of MyFaces 1.2 is usable and can be used for development.

See the announcement message if you want to use the MyFaces 1.2 snapshot:

http://www.mail-archive.com/users@myfaces.apache.org/msg37324.html

Thanks to the community!

Friday, October 06, 2006

MyFaces 1.2 (JSR-252) being implemented

An active effort is being done to have a MyFaces 1.2 implementation,
so we will have it eventually, sooner or later depending on the
participation of the developers/community. It is hard to say when a
release will be done, but all the tasks identified are tagged as
JSR-252 in JIRA. Although the number of tasks can increase, we believe
that almost everything is contained in those taks, so you can estimate
how far are we from releasing MyFaces 1.2... hopefully this might be in a few weeks!

Sunday, June 25, 2006

Tutorial on how to create a custom JSF component library available!

I have just created a tutorial on how to create your custom JSF
components library. It uses the MyFaces JSF
Components Archetype to generate the project structure and explains
how to implement a new component, by analysing the example component
that comes with the archetype.

You can find the tutorial here.

Hope you like it!

Wednesday, June 21, 2006

MyFaces Archetypes

Hi there, I will start blogging by talking about the MyFaces project and its maven archetypes. An archetype is a great mechanism to setup a new project from scratch using only one command. Sometimes it can be cumbersome to start a project, as you have to define the file structure and the dependencies on external libraries. Maven archetypes will do all this for you.

There are two different archetypes for MyFaces (and another archetype for Trinidad/ADF subproject, the set of components donated by Oracle). The two MyFaces archetypes are:
  • MyFaces Archetype: this archetype creates the basic structure for a project that will use MyFaces. It includes all the dependencies needed so you don't have to find them out. The best way to start a new web application.

  • JSF Components Archetype: aimed to those that want to setup a JSF component library project. This archetype will create a maven multi-module project, that contains the artifact for the JSF components and a webapp for the examples. Everything setup and prepared to be deployed out-of-the-box! Includes a very simple demo component, that can be used in any JSF implementation.

The information on how to use these archetypes can be found in this page of the MyFaces wiki.

Start coding now using JSF. These archetypes make life easier. There is no excuse!