diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java index f2c8db266..ad58f34b7 100644 --- a/src/main/org/apache/tools/ant/DefaultLogger.java +++ b/src/main/org/apache/tools/ant/DefaultLogger.java @@ -130,11 +130,7 @@ public class DefaultLogger implements BuildListener { // Print out the name of the task if we're in one if (event.getTask() != null) { - String name = event.getTask().getClass().getName(); - int pos = name.lastIndexOf("."); - if (pos != -1) { - name = name.substring(pos + 1); - } + String name = event.getTask().getTaskName(); String msg = "[" + name + "] "; for (int i = 0; i < (LEFT_COLUMN_SIZE - msg.length()); i++) { diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index dcb44feda..d59ab27d9 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -116,7 +116,10 @@ public class IntrospectionHelper { Class returnType = m.getReturnType(); Class[] args = m.getParameterTypes(); - if ("setLocation".equals(name) || "setDescription".equals(name)) { + // not really user settable properties + if ("setLocation".equals(name) || + "setDescription".equals(name) || + "setTaskName".equals(name)) { continue; } diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 3f88f8371..610c1416e 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -400,6 +400,7 @@ public class Project { task=taskA; } task.setProject(this); + task.setTaskName(taskType); String msg = " +Task: " + taskType; log (msg, MSG_VERBOSE); return task; diff --git a/src/main/org/apache/tools/ant/Task.java b/src/main/org/apache/tools/ant/Task.java index c3c792022..e8cdff20e 100644 --- a/src/main/org/apache/tools/ant/Task.java +++ b/src/main/org/apache/tools/ant/Task.java @@ -56,6 +56,8 @@ package org.apache.tools.ant; /** * Base class for all tasks. + * + *

Use {@link Project#createTask Project.createTask} to create a new Task. */ public abstract class Task { @@ -64,6 +66,7 @@ public abstract class Task { protected Target target = null; protected String description=null; protected Location location = Location.UNKNOWN_LOCATION; + protected String taskName = null; /** * Sets the project object of this task. This method is used by @@ -80,7 +83,7 @@ public abstract class Task { /** * Get the Project to which this task belongs * - * @param the task's project. + * @return the task's project. */ public Project getProject() { return project; @@ -98,12 +101,30 @@ public abstract class Task { /** * Get the Target to which this task belongs * - * @param the task's target. + * @return the task's target. */ public Target getOwningTarget() { return target; } + /** + * Set the name with which the task has been invoked. + * + * @param name the name the task has been invoked as. + */ + public void setTaskName(String name) { + this.taskName = name; + } + + /** + * Get the name with which the task has been invoked. + * + * @return the name the task has been invoked as. + */ + public String getTaskName() { + return taskName; + } + /** * Log a message with the default (INFO) priority. *