You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

setpermissions.html 3.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>SetPermissions Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="setpermissions">SetPermissions</a></h2>
  23. <p><em>Since Ant 1.10.0.</em></p>
  24. <h3>Description</h3>
  25. <p>Changes the file permissions using Java's NIO support for
  26. permissions.</p>
  27. <p>This task provides a subset of the platform specific abilities of
  28. <a href="chmod.html">chmod</a> and <a href="attrib.html">attrib</a>
  29. in a platform independent way.</p>
  30. <p>If no permissions are specified either via the mode or the
  31. permissions attribute, then all permissions will be removed from the
  32. nested resources.</p>
  33. <p>The task accepts aribitrary resources as part of the nested
  34. resource collections, but not all resources support setting
  35. permissions. This task won't do anything for resources that don't
  36. support setting permissions - for example URLs.</p>
  37. <p>The permissions are applied to all resources contained within the
  38. nested resources collections. You may want to ensure the collection
  39. only returns files or directories if you want different sets of
  40. permissions to apply to either type of resource.</p>
  41. <h3>Parameters</h3>
  42. <table border="1" cellpadding="2" cellspacing="0">
  43. <tr>
  44. <td valign="top"><b>Attribute</b></td>
  45. <td valign="top"><b>Description</b></td>
  46. <td align="center" valign="top"><b>Required</b></td>
  47. </tr>
  48. <tr>
  49. <td valign="top">permissions</td>
  50. <td valign="top">The permissions to set as comma separated list of
  51. names
  52. of <a href="http://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/PosixFilePermission.html">PosixFilePermission</a>
  53. values.</td>
  54. <td valign="top" align="center">No</td>
  55. </tr>
  56. <tr>
  57. <td valign="top">mode</td>
  58. <td valign="top">The permissions to set as tradional Unix
  59. three-digit octal number.</td>
  60. <td valign="top" align="center">No</td>
  61. </tr>
  62. <tr>
  63. <td valign="top">failonerror</td>
  64. <td valign="top">Whether to stop the build if setting permissions
  65. fails.</td>
  66. <td valign="top" align="center">No, defaults to true</td>
  67. </tr>
  68. </table>
  69. <h3>Parameters specified as nested elements</h3>
  70. <h4>any resource collection</h4>
  71. <p><a href="../Types/resources.html#collection">Resource
  72. Collection</a>s are used to select groups of resources.</p>
  73. <h3>Examples</h3>
  74. <blockquote><pre>
  75. &lt;setpermissions mode=&quot;755&quot;&gt;
  76. &lt;file file=&quot;${dist}/start.sh&quot;/&gt;
  77. &lt;/setpermissions&gt;
  78. </pre></blockquote>
  79. <p>makes the &quot;start.sh&quot; file readable and executable for
  80. anyone and in addition writable by the owner.</p>
  81. <blockquote><pre>
  82. &lt;setpermissions permissions=&quot;OWNER_READ,OWNER_WRITE,OWNER_EXECUTE,OTHERS_READ,OTHERS_EXECUTE,GROUP_READ,GROUP_EXECUTE&quot;&gt;
  83. &lt;file file=&quot;${dist}/start.sh&quot;/&gt;
  84. &lt;/setpermissions&gt;
  85. </pre></blockquote>
  86. <p>makes the &quot;start.sh&quot; file readable and executable for
  87. anyone and in addition writable by the owner.</p>
  88. </body>
  89. </html>