Matt RaibleMatt Raible is a Web Architecture Consultant specializing in open source frameworks.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: AngularJS, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

AppFuse Light converted to Maven modules, upgraded to Tapestry 5 and Stripes 1.5

This past week, I stayed up a couple of late nights to do some of the AppFuse Light work I wrote about in October. I converted all web frameworks to Maven modules, as well as made them inherit from the appfuse-web project. Below is what the new module structure looks like:

New AppFuse Light Modules

At this point, the project is ready to import into AppFuse's SVN project. Here's a list of other changes I made:

  • Modules now depend on AppFuse's backend and allow you to use Hibernate, JPA or iBATIS as the persistence framework. Implementations for Spring JDBC, OJB and JDO have been removed.
  • Upgraded to JWebUnit 2.1, which now uses HtmlUnit under the hood and has much better JavaScript support. It also has Selenium support, but I've yet to try it.
  • Ajaxified Body integrated into all frameworks. You can easily turn it off by modifying the global.js file.
  • Prototype and Scriptaculous loaded from Google's Ajax Libraries CDN.
  • Upgraded to Tapestry 5. Mad props to Serge Eby and his tapestry5-appfuse project for showing me how to do this. Serge became a committer on AppFuse recently, so hopefully we'll continue to see great things from the Tapestry 5 support. I really like the clean URLs and minimum configuration required in Tapestry 5. It's testing framework is nice too, but I believe it could be improved.
  • Upgraded to Stripes 1.5. This was easy and painless. I'm definitely a fan of Stripes and look forward to reading the Stripes book on my bookshelf.
  • Dropped support for: Struts 1.x, WebWork, Spring MVC + Velocity.

If you want to try any of these applications, you can create archetypes using the following commands:

svn co https://appfuse-light.dev.java.net/svn/appfuse-light/trunk appfuse-light
cd appfuse-light/preferred-web-framework
mvn archetype:create-from-project
cd target/generated-sources/archetype
mvn install
cd ~/dev
mvn archetype:generate # The new archetype should show up as an option

Next steps include figuring out a way to flatten the inherited dependencies and plugins so archetype:create-from-project can create truly standalone projects. Please let me know if you have any questions.

Posted in Java at Dec 20 2008, 06:42:03 PM MST 9 Comments
Comments:

Although I use Appfuse regular, just want to say I'm a fan of Spring MVC. Very clean and clear framework.

Posted by Marc on December 21, 2008 at 10:49 AM MST #

Personally, I'm disappointed to see support for Spring JDBC being removed from the project. In the organisation where I work, ORMs such as Hibernate are prohibited, so Spring-JDBC is the best option available to me. The prohibition of Hibernate is not a decision I agree with, but one I have to live with. Nevertheless for projects that have a DB of only a few tables, an ORM is probably overkill, and given that JDBC could be considered the "lingua franca" of database connectivity, maybe it's worth reconsidering this decision?

Keep up the great work!

Posted by Donal on December 21, 2008 at 11:04 PM MST #

Also a big fan of Spring MVC and Velocity. Sad to see it going, that combination is what we use at work very successfully. I know at least one site that migrated from Tapestry to Spring MVC with very positive results. If anything I would expect a Spring 2.5 version of Spring MVC with the annotations. Maybe you already have.

I tried to follow your instructions, but it seemed to require an svn login. That makes sense, given https in the url.

Paul Sundling
http://www.gamerleague.com

Posted by Paul Sundling on January 04, 2009 at 07:46 AM MST #

OK, so a quick google search turned up the appfuse site and I was able to download the 1.8.2 version of appfuse light. The answer is you're using the Spring 2.5 MVC annotations somewhat, but only in a backwards compatible style.

This blogpost goes over what I mean:
http://rossenstoyanchev.org/blog/category/spring-mvc/

Especially given Spring 3 will deprecate the controller hierarchy, it might be interesting to try out the new style. The blogger did a really nice presentation at Spring One that explains it well. Too bad I haven't seen him post the presentation. I saw a copy from a coworker who went this year.

Posted by Paul Sundling on January 04, 2009 at 08:07 AM MST #

Appfuse lite was missing the codehaus repository, so it failed for me. Here is the working respository section from pom.xml. It will of course allready work for anyone who already have codehaus in their settings.xml:

   <repositories>
        <repository>
	      <id>codehaus</id>
	      <name>Codehaus Release Repo</name>
	      <url>http://dist.codehaus.org/</url>
	    </repository>
        <repository>
            <id>java.net</id>
            <url>http://download.java.net/maven/2</url>
        </repository>
    </repositories>

BTW, I have a comprehensive presentation on Maven 2 at the LA Java User Group and I used Appfuse for the demo to show how you could start from nothing, get an archetype and go from there. :) Very good stuff, your efforts are appreciated.

I know it would be crazy because of the combinatorial effects, but have you thought about having multiple ajax library implementations to compare like you have frameworks. With approaches like Unobtrusive javascript, it might not be horrific to handle, perhaps just a different include per ajax framework that could all be changed via some switching mechanism. I really like jQuery myself. I imagine even the thought of that has you pulling your hair out. :)

Posted by Paul Sundling on January 04, 2009 at 10:35 AM MST #

@Donal - the good news is you can still use Spring JDBC. The dependency is in the classpath. The reason I dropped Spring JDBC is because AppFuse Light now uses AppFuse's backend (which doesn't have a JDBC implementation).

@Paul - have you tried FreeMarker? The reason I removed Velocity is because FreeMarker seems like a better option with better error reporting and support for JSP tags. As far as the svn login, it's "guest" with a blank password.

AppFuse Light's Spring MVC + Annotations: I'm sure this can be improved. Patches most welcome. ;-)

Why did you need the Codehaus repository? Which dependencies aren't found in the central repo?

Thanks to everyone for the feedback!

Posted by Matt Raible on January 04, 2009 at 12:22 PM MST #

I get the following error when running mvn archetype:create-from-project:

[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ----------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: org.appfuse
ArtifactId: appfuse-light
Version: 2.1-SNAPSHOT

Reason: Unable to download the artifact from any repository

org.appfuse:appfuse-light:pom:2.1-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2)

Posted by Randy Jones on January 12, 2009 at 02:27 PM MST #

@Randy - I believe you might need to do this as a second step:

cd appfuse-light
mvn install -N

Hope this helps.

Posted by Matt Raible on January 12, 2009 at 02:33 PM MST #

I had to use the maven -U option to get the latest version of the archetype plugin
mvn -U archetype:create-from-project
This used version 2.0-alpha-4 of the archetype plugin. Maybe you could specify the version to use in the parent pom
    <build>
        <plugins>
          <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-archetype-plugin</artifactId>
           <version>2.0-alpha-4</version>
          </plugin>
        </plugins>
    </build>

</project>

Posted by Kieron Edwards on February 17, 2009 at 09:20 PM MST #

Post a Comment:
  • HTML Syntax: Allowed