diff --git a/WHATSNEW b/WHATSNEW
index e02742e70..7fceecac4 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -101,6 +101,8 @@ Other changes:
* spelling fixes, occurred. Bugzilla Report 27282.
+* add uid and gid to tarfileset. Bugzilla Report 19120.
+
Changes from Ant 1.6.0 to Ant 1.6.1
=============================================
diff --git a/docs/manual/CoreTasks/tar.html b/docs/manual/CoreTasks/tar.html
index aec19ea4a..065146e4d 100644
--- a/docs/manual/CoreTasks/tar.html
+++ b/docs/manual/CoreTasks/tar.html
@@ -135,14 +135,27 @@ attributes
username |
- The username for the tar entry. This is not the same as the UID, which is
- not currently set by the tar task. |
+ The username for the tar entry. This is not the same as the UID.
+ |
No |
group |
- The groupname for the tar entry. This is not the same as the GID, which is
- not currently set by the tar task. |
+ The groupname for the tar entry. This is not the same as the GID.
+ |
+ No |
+
+
+ uid |
+ The user identifier (UID) for the tar entry. This is an integer value
+ and is not the same as the username. since Ant 1.6.2.
+ |
+ No |
+
+
+ gid |
+ The group identifier (GID) for the tar entry. since Ant 1.6.2.
+ |
No |
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java
index cf232c180..6f4c0da0d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Tar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java
@@ -378,6 +378,8 @@ public class Tar extends MatchingTask {
}
te.setUserName(tarFileSet.getUserName());
te.setGroupName(tarFileSet.getGroup());
+ te.setUserId(tarFileSet.getUid());
+ te.setGroupId(tarFileSet.getGid());
tOut.putNextEntry(te);
@@ -436,6 +438,8 @@ public class Tar extends MatchingTask {
private String userName = "";
private String groupName = "";
+ private int uid;
+ private int gid;
private String prefix = "";
private String fullpath = "";
private boolean preserveLeadingSlashes = false;
@@ -519,8 +523,7 @@ public class Tar extends MatchingTask {
/**
* The username for the tar entry
- * This is not the same as the UID, which is
- * not currently set by the task.
+ * This is not the same as the UID.
* @param userName the user name for the tar entry.
*/
public void setUserName(String userName) {
@@ -534,10 +537,25 @@ public class Tar extends MatchingTask {
return userName;
}
+ /**
+ * The uid for the tar entry
+ * This is not the same as the User name.
+ * @param userName the user name for the tar entry.
+ */
+ public void setUid(int uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @return the uid for the tar entry
+ */
+ public int getUid() {
+ return uid;
+ }
+
/**
* The groupname for the tar entry; optional, default=""
- * This is not the same as the GID, which is
- * not currently set by the task.
+ * This is not the same as the GID.
* @param groupName the group name string.
*/
public void setGroup(String groupName) {
@@ -551,6 +569,22 @@ public class Tar extends MatchingTask {
return groupName;
}
+ /**
+ * The GID for the tar entry; optional, default="0"
+ * This is not the same as the group name.
+ * @param groupName the group name string.
+ */
+ public void setGid(int gid) {
+ this.gid = gid;
+ }
+
+ /**
+ * @return the group identifier.
+ */
+ public int getGid() {
+ return gid;
+ }
+
/**
* If the prefix attribute is set, all files in the fileset
* are prefixed with that path in the archive.