Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

What would you choose as the default Ant target?
In the context of a small visual tool with a user interface, open source.

I was thinking about jar because the project's distributable is the jar file.

But someone prefers to have help as the default target, to show the available targets.

Or maybe another target? I doubt anyone would really care, but would be the "least surprise" choice?

share|improve this question
    
I think "least surprise" target would be maven :) –  gnat Jul 6 '12 at 7:37

2 Answers 2

The name of the default Ant target is not as important as setting it to whichever target will be used most frequently by end users. Good default target names include:

  • build
  • dist
  • jar
  • main

If your Ant project contains many targets, it can be confusing to new users to read through all the target descriptions (e.g. by listing all the targets by default). The first time building a new project it is convenient to be able to type ant at the command prompt and get the desired deliverable.

Each target should be documented by utilizing the description attribute so that running ant -p provides sufficient information for most users to quickly evaluate the remaining targets in your project. The same principles apply when running the Ant build from within a GUI.

share|improve this answer

This is just personal preference - as any answer to this question is likely to be:

I tend to always have help as the default target. My reasoning is that unless you've looked at the build script or have used it before, you don't know what exactly you're going to get if you just calling the default target.

Even if your projects all use the same set of standard targets, there might be custom properties which will affect what you get out - e.g. build for debug/release, or create a signed/unsigned jar. I tend to have the default help target just display that non-standard info, alongside a couple of example usages.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.