blob: 5d21394807248c44876ee6ee519d414aca841591 [file] [log] [blame]
////
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
https://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.
////
Publishes the current module's link:../ivyfile/publications{outfilesuffix}[artifacts] and the link:../ivyfile{outfilesuffix}#resolved[resolved descriptor] (delivered Ivy file).
This task is meant to publish the current module descriptor together with its declared publication artifacts to a repository.
All the artifacts must have been created _before_ calling this task. It does not create the artifacts themselves, but expects to find them at the location indicated by the artifacts pattern.
The target repository is given through the name of a resolver declared in current Ivy settings. See link:../settings{outfilesuffix}[Settings Files] for details about resolver supporting artifact publishing.
It also publishes the delivered Ivy file (except if you don't want), and even delivers it, if it has not been done with a previous deliver call or if forcedeliver is set to true. That's why this task takes some parameters useful only for delivery. See the illustration below:
image::../images/ivy-publish-fc.png[]
(*__since 1.4.1__*) The source artifact pattern can be specified either as an attribute on the task (artifactspattern) or using a list of nested artifacts element (see examples below).
== Attributes
[options="header",cols="15%,50%,35%"]
|=======
|Attribute|Description|Required
|organisation|the name of the organisation of the module to publish|No. Defaults to `${ivy.organisation}` or the last resolved module organisation.
|module|the name of the module to publish|No. Defaults to `${ivy.module}` or the last resolved module name.
|revision|the revision of the module to publish and also the published revision unless pubrevision is set|No. Defaults to `${ivy.revision}` or the last resolve module revision.
|artifactspattern|the pattern to use to find artifacts to publish|No. Defaults to `${ivy.publish.src.artifacts.pattern}`
|resolver|the name of the resolver to use for publication|Yes
|pubrevision|the revision to use for the publication|No. Defaults to the `${ivy.deliver.revision}`
|pubbranch|the branch to use for the publication|No. Defaults to the `${ivy.deliver.branch}`
|forcedeliver|`true` to force the implicit call to deliver, `false` to do it only if the Ivy file to publish doesn't exist yet (*__since 1.4__*)|No. Defaults to `false`
|update|`true` to update Ivy file metadata (revision, branch, publication date and status) before publishing, `false` otherwise. This is usually not necessary when using deliver before publish.|No. Defaults to `false`
|merge|if this descriptor link:../ivyfile/extends{outfilesuffix}[extends] a parent, merge the inherited information directly into this descriptor on publish. The __extends__ element itself will be commented out in the published descriptor. (*__since 2.2__*)|No. Defaults to false
|validate|`true` to force Ivy files validation against ivy.xsd, `false` to force no validation|No. Defaults to default Ivy value (as configured in link:../settings{outfilesuffix}[settings file])
|replacedynamicrev|`true` to replace dynamic revisions by static ones in the delivered file, `false` to avoid this replacement (*__since 1.3__*)|No. Defaults to `true`
|publishivy|`true` to publish delivered Ivy file, `false` otherwise|No. Defaults to `true`
|conf|A comma separated list of configurations to publish (*__since 1.4.1__*). Accepts wildcards (*__since 2.2__*).|No. Defaults to all configurations
|overwrite|`true` to overwrite files in repository if the revision already exists, `false` to let it as is|No. Defaults to `false`
|warnonmissing|`true` to warn when artifacts to be published are missing|No. Defaults to `true`
|haltonmissing|`true` to halt build when artifacts to be published are missing|No. Defaults to `true`
|srcivypattern|the pattern to use to find Ivy file to publish, and even deliver if necessary (*__since 1.2__*)|No. Defaults to the value of `artifactspattern`
|pubdate|the publication date to use for the delivery, if necessary. This date should be either `now`, or a date given with the following pattern: `yyyyMMddHHmmss`|No. Defaults to `now`
|status|the status to use for the delivery, if necessary|No. Defaults to `${ivy.status}`
|delivertarget|the target to call for recursive delivery|No. No recursive delivery is done by default
|settingsRef|A reference to Ivy settings that must be used by this task (*__since 2.0__*)|No, default to `ivy.instance`.
|=======
== Child elements
[options="header"]
|=======
|Element|Description|Cardinality
|artifact|Describe additional artifacts to publish. These elements can have any attributes: standard artifact attributes and (*__since 2.2__*) extra attributes are supported.|0..n
|artifacts|Specify the pattern used to find the artifact. These elements have a `pattern` attribute containing the pattern used to find the artifact.|0..n
|=======
== Examples
[source,xml]
----
<ivy:publish resolver="local" pubrevision="1.0">
<artifacts pattern="build/artifacts/jars/[artifact].[ext]"/>
<artifacts pattern="build/artifacts/zips/[artifact].[ext]"/>
</ivy:publish>
----
Publishes the last resolved module in the local resolver with revision 1.0, looking for artifacts in directories `build/artifacts/jars` and `build/artifacts/zips`.