2016-04-17 17:30:07 +02:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
|
|
|
<title>SetPermissions Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="setpermissions">SetPermissions</h2>
|
2018-01-24 21:40:28 +01:00
|
|
|
<p><em>Since Ant 1.10.0</em>.</p>
|
2016-04-17 17:30:07 +02:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Changes the file permissions using Java's NIO support for permissions.</p>
|
|
|
|
<p>This task provides a subset of the platform specific abilities of <a href="chmod.html">chmod</a>
|
|
|
|
and <a href="attrib.html">attrib</a> in a platform independent way.</p>
|
|
|
|
<p>If no permissions are specified either via the mode or the permissions attribute, then all
|
|
|
|
permissions will be removed from the nested resources.</p>
|
|
|
|
<p>The task accepts arbitrary resources as part of the nested resource collections, but not all
|
|
|
|
resources support setting permissions. This task won't do anything for resources that don't support
|
|
|
|
setting permissions—for example URLs.</p>
|
|
|
|
<p>The permissions are applied to all resources contained within the nested resources
|
|
|
|
collections. You may want to ensure the collection only returns files or directories if you want
|
|
|
|
different sets of permissions to apply to either type of resource.</p>
|
2016-04-17 17:30:07 +02:00
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2016-04-17 17:30:07 +02:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2016-04-17 17:30:07 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>permissions</td>
|
|
|
|
<td>The permissions to set as comma separated list of names
|
2018-03-08 07:43:53 +01:00
|
|
|
of <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/file/attribute/PosixFilePermission.html"
|
|
|
|
target="_top">PosixFilePermission</a> values.</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No</td>
|
2016-04-17 17:30:07 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>mode</td>
|
|
|
|
<td>The permissions to set as traditional Unix three-digit octal number.</td>
|
|
|
|
<td>No</td>
|
2016-04-17 17:30:07 +02:00
|
|
|
</tr>
|
2016-05-16 11:41:07 +02:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>nonPosixMode</td>
|
|
|
|
<td>What to do if changing the permissions of a file is not possible because the file-system
|
|
|
|
doesn't support POSIX file permissions. Possible options are <q>fail</q> (fail the
|
|
|
|
build), <q>pass</q> (just log an error), <q>tryDosOrFail</q> (at least try to set the
|
|
|
|
read-only flag on DOS file systems, fail if that isn't possible either)
|
|
|
|
and <q>tryDosOrPass</q> (at least try to set the read-only flag on DOS file systems, just log
|
|
|
|
an error if that isn't possible either).</td>
|
|
|
|
<td>No; defaults to <q>fail</q></td>
|
2016-05-16 11:41:07 +02:00
|
|
|
</tr>
|
2016-04-17 17:30:07 +02:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>failonerror</td>
|
|
|
|
<td>Whether to stop the build if setting permissions fails.</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2016-04-17 17:30:07 +02:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
|
|
|
|
<h4>any resource collection</h4>
|
2018-03-05 17:35:30 +01:00
|
|
|
<p><a href="../Types/resources.html#collection">resource collections</a> are used to select groups
|
2018-02-28 07:58:59 +01:00
|
|
|
of resources.</p>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
2016-04-17 17:30:07 +02:00
|
|
|
<h3>Examples</h3>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
|
|
|
<p>Make the <samp>start.sh</samp> file readable and executable for anyone and in addition writable
|
|
|
|
by the owner.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2016-04-17 17:30:07 +02:00
|
|
|
<setpermissions mode="755">
|
|
|
|
<file file="${dist}/start.sh"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</setpermissions></pre>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
|
|
|
<p>Make the <samp>start.sh</samp> file readable and executable for anyone and in addition writable
|
2018-02-28 07:58:59 +01:00
|
|
|
by the owner.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2016-04-17 17:30:07 +02:00
|
|
|
<setpermissions permissions="OWNER_READ,OWNER_WRITE,OWNER_EXECUTE,OTHERS_READ,OTHERS_EXECUTE,GROUP_READ,GROUP_EXECUTE">
|
|
|
|
<file file="${dist}/start.sh"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
</setpermissions></pre>
|
2016-04-17 17:30:07 +02:00
|
|
|
</body>
|
|
|
|
</html>
|