ANT-Based Projects Demo (5 Minutes)


Showcase NetBeans' ANT based project system.

Points to Hit

  • No other IDE has something like this
  • Your Ant script *is* your project
  • Historically, projects have been a way IDEs lock you in
  • You get dependent on how your IDE compiles things - and you don't actually know how that is!
  • It would be too much work to set up your project all over again in another IDE
  • In most IDEs projects are binary, non-human readable and non-sharable
  • Having something different happen on your build server that's pushing bits up to the web causes PROBLEMS
  • We've seen this in the past working on !NetBeans - where we were still building on 1.3, but somebody compiled something against 1.4, checked it in, and it can't compile on 1.3, and they were gone for the weekend.
  • In NetBeans you can be absolutely sure that what happens when you build in your IDE is exactly what happens in your headless builds, on your testing server, wherever

Demo Prep

  • Download the source code for jEdit with no NetBeans project created for it.
  • The jEdit build script doesn't have a run target, so add the following:
      <!-- Run jEdit -->
      <target name="run" description="Runs jEdit" depends="dist, compile, init">
          <java jar="jedit.jar"


  • If you've run this demo previously, make sure you've deleted the nbproject subdirectory of jEdit (see Demo Cleanup) or you won't be able to create a new jEdit project.


  1. Create a new project.
  • Show the build script.
  • Run the project and show how the output window is the the output from the Ant script.
  1. Note that all the files are human readable and editable. Note what is the nbproject/ subdirectory
  • That it identifies the project as a NetBeans project
  • That what it contains depends on the project type
  • That the private/ subdirectory is where hard coded paths live and is not shared; that it will automatically be added to .cvsignore et. al. if you're using !NetBeans versioning support
  1. "But probably you have existing sources..." Create a New General Project with Existing Ant Script and click Next.
  2. Point it at the jEdit source directory.
  3. Note that
  • the build file was found automatically
  • the directories are correct
  1. Press Next. Note how it found all but the "Build Project" target. Select the "dist" target from the Build combo box and press Next.
  2. Source Package Folder. Add the Source Package Folder, jEdit (same as project root in this case) and press Finish.
  3. Give a brief tour of the project in the Projects tab and the Files tab.
  4. "Now lets see if it really works" - Choose Clean and Build from the Project tab and wait for it to build.
  5. Choose Run from the Run menu and wait for jEdit to come up.
  6. (Optional) Right-click build.xml and choose Debug Target | Run to show off the Ant debugger.
  7. (Optional) Also demo XML code completion in Ant scripts

Demo Cleanup

  • Run Clean Project on jEdit.
  • Delete the "nbproject" subdirectory of the jEdit source directory.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo