On Tue, Apr 28, 2015 at 8:51 AM, Alan Snyder wrote:

> Why not just postpone issuing the message until a task is attempted
> that needs the JDK?

Agreed.

But I guess it would require updating such tasks since it is likely that
such tasks today will likely just error out by not being able to load a
specific class that tools.jar provides, but the end-user may not make
the connection that that failure of loading the class is due to no
tools.jar being present.

Note, the argument can be made that the current warning message provides
little help also since it is at the beginning of the diagnostic output
when ant is executed, so there is no clear indication that the inability
of finding tools.jar is the cause of a task error later on.

Looking at the code, Locator.getToolsJar() should not be printing any
messages at all.  Only Launcher.java calls it, and it appears a better
solution than what Jan proposes is to modify the interactiong between
the Launcher and the Locator.  Maybe add something to Locator a method
called haveTools() (or some other name that is deemed more appropriate)
which returns a boolean if the compiler tools are already available
(using the class loading method currently inside getToolsJar()).

getToolsJar() is modified to solely find the tools.jar file, returning
null if not found.

Laucher is modified to first call Locator.haveTools(), and if true, then
no need to deal with tools.jar.  If false, call Locator.getToolsJar().
If it return null, Launcher can print a diagnostic, but only if verbose
or debug option has been specified, or if --launchdiag is specified
since Launcher already has that option for other things.

Alternatively, Locator.getToolsJar() is updated (or overloaded) to
support a diagnostics flag to indicate if failure to detect tools.jar
should generate a message.  Launcher is modified to pass the value of
its launchDiag setting when invoking the method.

--ewh

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to