Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta.

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.


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.

Ant Hacks by Erik Hatcher

The first session I attended was Erik Hatcher's Ant Hacks talk. The first half of his talk was about Ant in general and was most of the stuff covered in Java Development with Ant. The good stuff was the 2nd half when he covered all the new stuff in Ant 1.6. Steve is working on an update to Java Development with Ant - shoujld will be a lot thinner. Below are some notes I took on what's new in 1.6.

  • <image> task. Requires Java Advanced Imaging API
    • Performs image manipulation
  • <import> task
    • No more entity ref includes needed - can use Ant properties for file reference now.
    • OO Nature
      • mix in imported build files - call super on imported file by specifying depends="${}.target" where the is specified in the imported build file. Only targets that are overridden will get prefixed with namespace.
      • target overriding - main build file takes precedence
      • "abstract" targets - requires main build file implementation
  • <subant> task - Recurses tree
    • Two modes: 1) same build file in each sub directory 2) crawl a tree and run same build file on all subdirectories
  • Can have targetless build files. Everything outside a target gets executed before any targets
  • <presetdef> - Use the same task and optionally repeat. Define the options once, give it a name and refer to it later. Can override attributes later in the build.xml file. Only works for one task at a time.
  • <macrodef> - bye bye antcall. Much faster than antcall - does all the same things
    • You can specify attributes and elements as part of the definition. Tasks are wrapped in a <sequential> tag.
      • attributes are referred to in tasks using @{attribute}
      • elements are simple placeholders using XML <element/>
    • I could really use this stuff in AppFuse to replace the compile-module and test-module targets
    • "spawn" a new attribute on <java> - allows process to live past when Ant dies
  • <scriptdef> - allows you to use all kinds of scripting languages - i.e. Groovy, JavaScript, etc.
    • the project, attributes and elements are given to you - so you can easily grab them in the scripts
    • helpful to know Ant's API when writing
  • <antlib> - componentizes definition of types and tasks
    • anything that defines stuff - put in antlib.xml (i.e. <taskdef>)
    • mostly designed for Ant task distributors because they can package an antlib.xml with a namespace
    • has root element of <antlib> instead of XML
      • xmlns:antcontrib="antlib:net.sf.antcontrib" - brings in all tasks into your project

I really liked Erik's talk because AppFuse was inspired by his Java Development with Ant book. Its build.xml file was intially based on Erik's sample app and therefore, the first half of his talk pretty much pointed out tips and tricks that I'm currently using. The 2nd half of his talk was highlighting the new features of 1.6 - which he's suggested I adopt in the past. I've never had much desire (or time) to dig in and update AppFuse's build.xml file to 1.6. However, after attending his talk - it seems like it should be pretty easy to do. Good bye <antcall>, hello <macrodef>.

Later: One of the coolest things I saw in Erik's talk was how his Ant logging was color coded. I asked him about it and all your need to do is specify "-logger" in an ANT_ARGS environment variable. Good stuff!

Posted in NFJS at Nov 12 2004, 05:12:12 PM MST 1 Comment

You can place an .antrc file in your home directory with the following options to turn that on: ANT_OPTS="$ANT_OPTS -Dant.logger.defaults=/home/ehauser/" ANT_ARGS="$ANT_ARGS -logger" If you don't like the default colors, then you need the colors defined in a property file. Here's my file: AnsiColorLogger.ERROR_COLOR=1;31 AnsiColorLogger.WARNING_COLOR=1;35 AnsiColorLogger.INFO_COLOR=1;36 AnsiColorLogger.VERBOSE_COLOR=1;34 AnsiColorLogger.DEBUG_COLOR=1;36

Posted by Eric Hauser on November 18, 2004 at 11:58 AM MST #

Post a Comment:
Comments are closed for this entry.