Matt RaibleMatt Raible is a writer with a passion for software. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, 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.
You searched this site for "ant". 338 entries found.

You can also try this same search on Google.

[ANN] Equinox 1.5 Released

This release's major new feature is dependency downloading using Maven 2's Ant tasks. The main reason I used Maven 2 over Ivy is because I've heard rumors that Ant 1.7 will include dependency downloading - and they're planning on integrating the work that Maven has already done.

One of the nice things about using Maven 2's Ant Tasks, is you can download Maven 2 and generate your Eclipse or IDEA (possibly even Netbeans) project files using "mvn eclipse:eclipse" or "mvn idea:idea". You can also use Maven 2 to build and test things if you like. The only thing that doesn't currently when using Maven to test Equinox is the web tests with Cargo. I can try to get those working if there's enough demand. For now, you'll have to use Ant if you want to test the UI.

All of the frameworks used in Equinox, as well as its build/test system is explained in Spring Live. A summary of the changes are below (detailed release notes can be found in JIRA):

  • Removed packaged JARs in favor of Maven 2's Ant Tasks. Dependencies are now downloaded on-demand, greatly reducing the size of Equinox-based applications.
  • By specifying compile, test and runtime dependencies in a pom.xml file, Equinox applications can now be built with Maven 2. The only difference between building with Maven 2 and Ant (at this time) is that the M2 build does not support testing with Cargo. However, there is an M2 Cargo plugin so this shouldn't be hard to fix if you have that itch.
  • Added DWR, Script.aculo.us and Prototype to simplify Ajax development.
  • Added Beandoc support - simply run "ant beandoc" to see javadoc-style documentation of Spring context files.
  • Refactored UserManagerTest to be UserManagerImplTest; renamed UserManagerIntegrationTest to UserManagerTest.
  • Changed BaseDAOTestCase to extend AbstractTransactionalDataSourceSpringContextTests.
  • [Hibernate] Added example ehcache.xml to web/WEB-INF/classes for default cache settings.
  • [JSF] Removed client-side validation because corejsf-validator.jar causes issues with Spring's Ant-style path matching.
  • [Spring] Fixed number editor and edit logic in UserFormController.
  • [Struts] Fixed issue with installation where ContextLoaderPlugin was loading ApplicationContext a 2nd time b/c the listener was not being commented out.
  • Dependent packages upgraded:
    • Cargo 0.6
    • Hibernate 3.1
    • iBATIS 2.1.6
    • JPOX 1.1.0 Beta 4
    • MyFaces 1.1.1
    • PostgreSQL JDBC Driver 8.1 Build 404
    • Spring 1.2.6
    • Struts 1.2.8

Download. For more information about installing the various options, see the README.txt file.

Demos:

The basic Equinox download contains all the various web and persistence framework options in the "extras" folder. If you have issues replacing the web framework or persistence engine, please enter an issue in JIRA and I'll build and upload a customized version for you.

Posted in Java at Dec 28 2005, 07:14:43 AM MST 4 Comments

New Computer - should I keep it?

HP Pavilion a1250n When I arrived here in Florida on Wednesday, I got a call from Julie saying my Windows Desktop was hosed. When she started it up, she just got a black screen. This is the problem with having a 23" Cinema Display hooked up to a Windows box - you can never see if anything went wrong on startup. I told her she needed to hook up one of my humongous 19" CRT monitors from the basement, and plug it in to see what was wrong. 10 minutes later, she calls me back and tells me the problem: it can't find the hard drive. I walk her though putting in the XP CD and trying to repair the drive, but it doesn't work. I tried to convince her to live w/o e-mail and the internet until I got home, but that didn't fly either.

I got a call from her yesterday afternoon telling me that she'd just bought a computer from Best Buy. I cringed. "Best Buy?", I thought. Knowing my penny-pinching wife, I figured the machine would be a $300 eMachine. However, she sent me a link and I was pleasantly surprised. She bought a HP Pavilion a1250n, which seems to be a dual AMD 64. After further reading, it seems it's a dual-core and not a dual processor. Regardless, I was quite proud that she bought something that I've been thinking of getting. I've used AMD-based machines in the past and they've always seemed much faster than an equivalent Pentium box.

This machine does seem to be a "media center" PC, which is expected when you buy it from Best Buy. But what exactly does that mean? Does it mean it won't make a good development box? We have 14 days to return it, so I'm wondering if I should. I don't really want to buy a new desktop (unless it's a G5), but my 2.6 GHz Dimension 8300 has thrown up quite a few times in the last few months - so I'm probably due. I tried to talk Julie into a G5, but a lot of the software she's using for her new business is Windows-only ... and VirtualPC sucks.

Update: I've decided to keep the box, mainly because my Dell Dimension 8300 is getting old and this one seems much faster. It's unlikely I'll ever have a Mac desktop because we still need and enjoy using Windows for a lot of things. I'd love to, but it just won't fly with the wife - as well as many software vendors out there. To make things a bit speedier, I did buy 4 GB of RAM for the HP today. I'll likely turn my Dell into a Suse box for Subversion, CUPS and Samba.

Posted in General at Dec 09 2005, 09:07:55 AM MST 22 Comments

Ant colored logging on Windows

In the past, I've had issues getting Ant's AnsiColorLogger to work on Windows with Cygwin. Thanks to a friend of mine, Steve DeRidder, I was finally able to figure out a working solution. Here's what you need to do if you're using Cygwin.

Install the "rxvt" component of Cygwin through its update tool. Once you've done that, there are two options for integration:

  • Right-click context menu: Download rxvt_reg.reg to your hard drive. Edit it with a text editor to point to your Cygwin installation and save it. Then right click on the file and "merge" it into your registry.
  • Shortcut: Create a new shortcut with the following command (all on one line, adjust your Cygwin path accordingly):
    C:\Tools\cygwin\bin\rxvt.exe -bg white -fg black -sr -sl 5000 -fn "Fixedsys" 
    -ls -e /usr/bin/bash --login -c "exec /bin/bash -rcfile ~/.bashrc"
    

Thanks for the tip Steve!

Posted in Java at Dec 01 2005, 06:19:51 PM MST Add a Comment

Edit Java webapps Redux: Jetty Launcher and Equinox

A few weeks ago, I realized I was developing webapps the hard way, by re-deploying everytime I made a change. It's important to have a build process that can create a WAR and deploy, but it's also important to have a system where you can edit/save/view changes w/o ever deploying.

I spent some time this weekend working with Jetty Launcher, Eclipse 3.1 and the latest version of Equinox. Below are instructions on how to make the two work together. Once you've completed the steps below, you should be able to launch Jetty and edit/save Java files or JSP files in Equinox - and the changes will show up immediately in your webapp. No deployment or Ant/Maven interaction necessary.

I've tested this setup on Eclipse 3.1, using both OS X and Windows XP.

Step 1: Install Jetty and Launcher

Download and install Jetty. I tested 5.1.4 and 5.1.6 and both seem to work (6.0.0 Beta does not). In Eclipse, go to Help » Software Updates » Find and Install. Select Search for new features to install and click Next. Click on the New Remote Site button and enter "Jetty Launcher" for the name and "http://jettylauncher.sourceforge.net/updates" for the URL. Click OK, continue to download and restart your workspace.

Step 2: Install Equinox and create Eclipse project files

Download Equinox 1.5 beta 1 and extract to your workspace (I generally use c:\Source on Windows and /Users/${username}/dev on OS X). Download Maven 2.0, install it, and add $M2_HOME/bin to your $PATH. From the command line, cd into the equinox directory and type "mvn eclipse:eclipse". Get a cup of coffee or soda while you wait for Maven to download all the dependencies.

Once the project files have been created, open Eclipse and go to File » New » Project » Java Project. Click Next and type "equinox" in the Project name box. Click Finish to begin importing the project. You'll probably get an error like the following. Click OK to continue.

Eclipse Error

Click Next to continue (I had to click it a few times before it took me to the next screen). On the next screen (Define the Java build settings), select the web directory and click Configure inclusion and exclusion filters. Click the Add button for Exclusion patterns and enter "WEB-INF/classes/" (the trailing slash is important).

You're not done yet, now you need to define the M2_REPO variable that points to all the downloaded dependencies. Click the Libraries tab and then the "Add Variable" button as seen below.

Eclipse Error

Click the Configure Variables button and add a new one with a name of M2_REPO and Path of to your local Maven repository (/Users/${username}/.m2/repository on OS X and C:\Documents and Settings\${username}\.m2\repository on Windows). Click OK, Cancel and then Finish.

Step 3: Configure Jetty Launcher for Equinox

In Eclipse, go to Run » Debug and select Jetty Web in the Configurations panel. Click the New button. In the "Use Options" section, use "web" for the webapp root and (optionally) "/equinox" for the context name.

Jetty has issues running applications that use commons-logging, so you'll need to turn off all the INFO logging from the projects that Equinox uses. To do this, click on the Arguments tab and add the following to the list of VM arguments:

-DDEBUG -DDEBUG_PATTERNS=org.appfuse -DDEBUG_VERBOSE=-1

This can be placed on the line below the -Djetty.home argument. For more information on logging in Jetty, see the Jetty logging and debugging tutorial.

Step 4: Start Jetty in debug mode and modify to your hearts content

Click Apply and then Debug, and watch Jetty startup. If you go to http://localhost:8080/equinox/users.html in your browser, you should see a log message like the following:

11:44:25.855 DEBUG  [SocketListener0-1] org.appfuse.web.UserController.handleRequest
(UserController.java:24) >29> entering 'handleRequest' method...

You should be able to click on "UserController.java:24" to navigate to the UserController.java class. In this class, modify the log.debug(...) message, save the file and hit refresh on your browser. The console should spit out your updated log message. If it didn't, go to Window » Preferences » Workspace and make sure Build automatically is checked.

As far as I can tell, edit/save/refresh will work for .java and .jsp files, but not for .xml files. For that, the Jetty Launcher adds a Stop/Restart Jetty icon to your Eclipse toolbar. This setup seems to work great, except for the fact that you can't see when Jetty is done starting up in the console.

NOTE: I tried to get a similar setup working with the Tomcat Eclipse Plugin (v3.1 beta) and the Eclipse Web Tools Project (v0.7.1). Neither worked as smoothly, and the WTP wouldn't even deploy to Tomcat.

Posted in Java at Nov 28 2005, 11:58:15 AM MST 8 Comments

Equinox 1.5 Beta 1 Released

This release is mainly to test out dependency downloading using Maven 2's Ant tasks. In addition, a few bugs have been fixed, but there's quite a few more on the roadmap. I plan to fix all of these before releasing 1.5 in a couple weeks.

Please test out this release if you have a chance. One of the nice things about using Maven 2's Ant Tasks, is you can download Maven 2 and generate your Eclipse or IDEA (possibly even Netbeans) project files using "mvn eclipse:eclipse" or "mvn idea:idea". You can also use Maven 2 to build and test things if you like. The only thing that doesn't currently work with Maven is the web tests with Cargo. I can try to get those working if there's enough demand. For now, you'll have to use Ant if you want to test the UI.

The download is much smaller now - barely over 1MB vs. ~20MB for 1.4. Most of the size comes from the Maven 2 Ant Tasks - which is a 869KB JAR. Of course, I could've made the distribution even smaller and required you to download the JAR and put it in $ANT_HOME/lib, but I decided to make things easier by including it.

For more information about installing the various options, see the README.txt file. Currently, you can use the following persistence frameworks:

  • Hibernate
  • iBatis
  • JDO (JPOX
  • OJB
  • Spring JDBC

And a number of web frameworks too, as listed below with links to demos.

Update: I forget to mention that I owe a big thanks to Carlos Sanchez. He (and the other Maven developers) have been great in helping to resolve all the issues I found with transitive dependencies.

Posted in Java at Nov 26 2005, 04:51:48 PM MST 4 Comments

Are you doing client-side validation in your JSF applications?

Are you doing client-side validation in your JSF application? I am in Equinox and AppFuse, but it seems somewhat primitive. I'm using David Geary's corejsf-validator.jar from his Core JSF book. It hooks into Commons Validator, and while it does work - it has some issues. First of all, if you have it in your classpath when testing, it screws up Ant-style path matching in Spring (applicationContext*.xml doesn't work). Secondly, it puts all the JavaScript validation functions right in your page, rather than in an external file that can be cached by your browser.

In reality, I believe that JSF should include client-side validation as part of the spec. After all, all of the other popular Java web frameworks support it. Then again, Rails is growing in popularity and AFAIK, it doesn't support it. In addition, the popular Java webapps I've seen (JIRA, Confluence, Jive Forums) don't use it either. I'm not trying to advocate that we should all be using client-side validation in our apps, I'm merely saying it should be an option in the standard web framework for Java.

The only public (and open source) option I've found is the Commons Validator support in Shale. Will this work in a MyFaces application w/o Shale? Are there other client-validation frameworks for JSF I don't know about? Or is the best option "don't use client-side validation with JSF?"

Posted in Java at Nov 24 2005, 09:02:39 AM MST 6 Comments

Editing Java webapps instead of edit/deploy/reload

For the last few years, I've always done Java webapp development the hard way. Yeah, I'm the guy that makes Dion cringe (although I'm pretty sure he's not referring directly to me). I edit a class/jsp/xml file and run "ant deploy reload". Then I wait a few seconds for my context to reload in Tomcat. Luckily, I do mostly test-first development, so it's rare that I have to open my browser to test stuff. However, with the power of CSS and Ajax, manual testing in a browser is becoming more and more useful (although Selenium may solve that).

I've long resisted the power of the IDE, b/c I've always trusted Ant and felt confortable with the command line. However, I'm ready for a change. I'm ready to start developing Equinox and AppFuse-based applications using the edit/save/auto-reload cycle. So how do I get started? Where's the instructions for setting up my IDEs to work this way?

I prefer to use Eclipse and IDEA for development - so I'll likely try to get this working in both. If I get it working, I'll make sure and provide good documentation so others can do the same. I'm also willing to make any changes in project structure to make this happen; modifying build.xml (or pom.xml) to accomodate shouldn't be too difficult.

Posted in Java at Nov 07 2005, 09:16:03 AM MST 23 Comments

MySQLDialect vs. MySQLInnoDBDialect

I've used Hibernate's MySQLDialect ever since I started using Hibernate and MySQL. However, I noticed with Hibernate 3 there's a couple of new MySQL Dialects in town: MySQLInnoDBDialect and MySQLMyISAMDialect. Using MySQLDialect still seems to work fine for me - and it handles transaction rollbacks when I'm using InnoDB types.

What's the point of these fine-grained dialects? Should they be used when possible, or does MySQLDialect default to one of these based on MySQL metadata? IMO, Hibernate's javadocs could stand to have a little more "doc" action. Maybe I'm just not looking in the right place for the answer to this question.

Posted in Java at Oct 19 2005, 08:53:16 AM MDT 5 Comments

Maven 2's Transitive Dependencies

I spent a few hours this week integrating Maven 2's Ant tasks into Equinox. Here's a things I discovered in the process.

  • The JAR you need to include to use the Maven Tasks is quite large, weighing in at a hefty 833K. Regardless, it's easier to include a ~1MB JAR in CVS than it is 10MB of JARs. Equinox (w/o the extras directory) weighs in at 10.2MB before, 1.3MB after.
  • The transitive dependencies feature needs to be cleaned up a fair bit. There are a *lot* of unnecessary dependencies downloaded for many libraries. For example, Hibernate downloads a bunch of JBoss JARs and the Display Tag downloads all the various web framework JARs. I found myself excluding almost as many dependencies as I added.
  • Using in-line dependencies (where you specify each one in your build.xml) is cleaner and requires less XML (b/c of attributes vs. elements). I went this route at first and it worked well, but to allow greater flexibility (for those who might want to use Maven 2), I ended up creating a pom.xml. 48 lines in build.xml turned into 195 lines in pom.xml.
  • The Maven Developer team provides fantastic support - both on the mailing list and IRC. Thanks Brett!
  • Maven 2.0 RC was released today.
  • I need to figure out a way to "install" the persistence/web framework options in Equinox. The easiest way from a maintenance perspective is to parse pom.xml to add new dependencies. Entity includes might make the project more extensible though - and easier to upgrade.
  • Once you have pom.xml in place, it's pretty easy to make the build/test/package process M2 friendly.
  • Maven 2 is faster than Ant.

Overall, it was a pretty frustrating experience, with lots of trail-and-error. In the end, I got it all figured out and the only "hack" I had to do was delete servlet-api-2.4.jar after copying dependencies into my WAR. This is b/c Ant is not smart enough to know that dependencies with a "provided" scope shouldn't be copied. I could probably have a 4th dependencies path to solve this, but deleting sounded easier at the time.

I'm not going to check anything in yet b/c I still have to modify all the installers to specify their dependencies. The main advantage I can see in using a download-dependencies feature is easier upgrading of dependencies. It'll also make a lot more sense in AppFuse b/c certain parts of project (i.e. appfuse-dao.jar) can be published as re-usable modules.

In the meantime, if you'd like to try out Equinox with this feature (works with both Maven 2 or Ant), you can integrate it into a CVS version with the following steps:

That's it! I'm sure some things can be improved - please let me know if you find any issues.

Posted in Java at Oct 15 2005, 12:57:39 PM MDT 7 Comments

DWR and Script.aculo.us now included in AppFuse and Equinox

Last night, I integrated DWR into both AppFuse and Equinox. AppFuse has had Script.aculo.us integrated since 1.8.2 and it's been great to work with - so I added it to Equinox as well. I added these with the philosophy that it's easier to remove them than to add them.

Thanks to Joe Walker (DWR), Thomas Fuchs (Script.aculo.us) and Sam Stephenson (Prototype) for authoring (and supporting) these great open source projects.

Next up: integrating Ivy (or Maven 2's Ant Tasks) for downloading dependencies. Hopefully both will still allow bundling JARs in a release so both AppFuse and Equinox can stick with the 1-download-to-get-everything philosophy. The main reason I'd like to integrate a dependency downloading tool is to reduce AppFuse's size in CVS, as well as make it easier to upgrade dependencies.

Posted in Java at Oct 10 2005, 09:40:33 AM MDT 14 Comments