Class ChannelSpec
Configured once per project, inside the apiOnlySubscriber block:
apiOnlySubscriber {
channel {
type = 'maven'
groupId = 'com.example.contracts'
}
}
maven is the default because it costs this plugin almost nothing.
The artifact is declared in a detached configuration and Gradle's own
dependency resolution performs the fetching, caching and up-to-date checking,
so the plugin carries no HTTP client, no cache and no retry policy of its
own.
file reads a local directory instead. It exists for iterating on a
contract before it is published anywhere, and is the only channel that touches
the filesystem directly.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.Property<String> The directory thefilechannel reads from.abstract org.gradle.api.provider.Property<String> The artifact extension the contracts are published with.abstract org.gradle.api.provider.Property<String> The Maven group the contracts are published under.abstract org.gradle.api.provider.Property<String> getType()Which kind of channel to resolve through.
-
Constructor Details
-
ChannelSpec
public ChannelSpec()Creates the specification withmavenas the channel type.Gradle instantiates this; a build script configures the instance handed to
ApiOnlySubscriberExtension.channel(org.gradle.api.Action)rather than constructing one.
-
-
Method Details
-
getType
Which kind of channel to resolve through.Either
"maven"or"file". Anything else fails the build with a message naming the channels that do exist.- Returns:
- the channel type; defaults to
"maven"
-
getGroupId
The Maven group the contracts are published under.Required by the
mavenchannel. A single subscription may override it throughSubscription.getGroupId()when one target is published somewhere else.- Returns:
- the group id, with no default
-
getExtension
The artifact extension the contracts are published with.Used by the
mavenchannel to form the dependency notationgroup:name:version@extension.- Returns:
- the extension; defaults to
"tgz"
-
getDirectory
The directory thefilechannel reads from.Archives are expected at
<directory>/<target>/<version>/<target>-<version>.tgz, which is the layoutapi-only-publisher publish --channel filewrites.- Returns:
- the directory, with no default
-