public final class JkMavenPublication
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
JkPomMetadata |
pomMetadata
Represents the Maven metadata for a publication.
|
JkRunnables |
postActions
Collection of runnables that are executed after publishing to M2 repos.
|
JkRunnables |
preActions
Collection of runnables that are executed before publishing to M2 repos.
|
Modifier and Type | Method and Description |
---|---|
JkMavenPublication |
addManagedDependenciesInPom(java.lang.String moduleId,
java.lang.String version)
Adds the specified moduleId and version in the dependencyManagement of the POM file to be published.
|
JkMavenPublication |
addRepos(JkRepo... repoArgs)
Adds the specified repositories to the publication repositories.
|
static JkDependencySet |
computeMavenPublishDependencies(JkDependencySet compileDeps,
JkDependencySet runtimeDeps,
JkCoordinate.ConflictStrategy strategy)
Computes the published transitive dependencies from the specified compile and runtime
dependencies of the project that we are publishing artifacts for.
|
JkMavenPublication |
customizeDependencies(java.util.function.Function<JkDependencySet,JkDependencySet> modifier)
Configure the dependencies that will be exported with the published module.
By default, JeKa computes it from the compile and runtime dependencies. |
JkRepo |
findFirstNonLocalRepo()
Shorthand to get the first declared publication repository.
|
JkFileSigner |
getDefaultSigner()
Returns the default file signer for this publication.
|
JkDependencySet |
getDependencies()
Returns the dependencies to be included in POM as transitive dependencies.
|
JkModuleId |
getModuleId()
Returns the moduleId (group + artifact name) for this publication.
|
JkRepoSet |
getRepos()
Returns the repositories where this publication will be published.
|
JkVersion |
getVersion()
Returns the version of the artifacts for this publication.
|
java.lang.String |
info()
Returns a string representation of the information for this
JkMavenPublication . |
static JkMavenPublication |
of(JkArtifactLocator artifactLocator)
Creates a
JkMavenPublication with the specified artifact locator. |
static JkMavenPublication |
of(JkBuildable buildable)
Creates a
JkMavenPublication for a given buildable object, configuring it
based on the specified buildable's properties such as artifacts, module information,
version, dependencies, and repositories. |
static JkMavenPublication |
ofPomOnly()
Creates a
JkMavenPublication that can contains only a POM, and no artifacts. |
JkMavenPublication |
publish()
Publishes this publication to its defined repositories
|
JkMavenPublication |
publishLocal()
Publishes this publication on the JeKa local repository
|
JkMavenPublication |
publishLocalM2()
Publishes this publication on the M2 local repository
|
JkMavenPublication |
putArtifact(JkArtifactId artifactId)
Adds the specified artifact to the publication assuming the artifact file will exist when
publish()
will be invoked. |
JkMavenPublication |
putArtifact(JkArtifactId artifactId,
java.util.function.Consumer<java.nio.file.Path> artifactFileMaker)
Adds the specified artifact to the publication.
|
JkMavenPublication |
putArtifactIf(boolean condition,
JkArtifactId artifactId)
Adds the specified artifact to the publication assuming the artifact file will exist when
publish()
will be invoked. |
JkMavenPublication |
removeArtifact(JkArtifactId artifactId)
Removes the specified artifact from this publication.
|
JkMavenPublication |
setBomResolutionRepos(java.util.function.Supplier<JkRepoSet> repoSupplier)
Sets the supplier providing the download repositories used to resolve BOMs.
|
JkMavenPublication |
setDefaultSigner(JkFileSigner defaultSigner)
Sets the default file signer to use for this publication.
|
JkMavenPublication |
setModuleId(java.lang.String moduleId)
Sets the moduleId (group + artifactName) for this publication.
|
JkMavenPublication |
setModuleIdSupplier(java.util.function.Supplier<JkModuleId> moduleIdSupplier)
Sets the supplier providing the moduleId (group + artifactName) for this publication.
|
JkMavenPublication |
setRepos(JkRepoSet repoSet)
Sets the repositories where this publication will be published.
|
JkMavenPublication |
setVersion(java.lang.String version)
Sets the version of the artifacts to publish.
|
JkMavenPublication |
setVersionSupplier(java.util.function.Supplier<JkVersion> versionSupplier)
Sets the supplier providing the version of the artifacts to publish.
|
java.lang.String |
toString() |
public final JkPomMetadata pomMetadata
public final JkRunnables preActions
public final JkRunnables postActions
public static JkMavenPublication of(JkArtifactLocator artifactLocator)
JkMavenPublication
with the specified artifact locator.artifactLocator
- The artifact locator for locating the artifact files to publish.public static JkMavenPublication of(JkBuildable buildable)
JkMavenPublication
for a given buildable object, configuring it
based on the specified buildable's properties such as artifacts, module information,
version, dependencies, and repositories.buildable
- The buildable object used to configure the Maven publication.JkMavenPublication
instance based on the given buildable object.public static JkMavenPublication ofPomOnly()
JkMavenPublication
that can contains only a POM, and no artifacts.
The typical usage is to publish BOMs.public JkMavenPublication customizeDependencies(java.util.function.Function<JkDependencySet,JkDependencySet> modifier)
public JkMavenPublication addManagedDependenciesInPom(java.lang.String moduleId, java.lang.String version)
public JkDependencySet getDependencies()
public JkMavenPublication setModuleIdSupplier(java.util.function.Supplier<JkModuleId> moduleIdSupplier)
public JkMavenPublication setModuleId(java.lang.String moduleId)
setModuleIdSupplier(Supplier)
public JkMavenPublication setVersionSupplier(java.util.function.Supplier<JkVersion> versionSupplier)
public JkMavenPublication setVersion(java.lang.String version)
setVersionSupplier(Supplier)
public JkMavenPublication setBomResolutionRepos(java.util.function.Supplier<JkRepoSet> repoSupplier)
public JkModuleId getModuleId()
public JkVersion getVersion()
public JkFileSigner getDefaultSigner()
Normally, each publish repository can define its own signer. Conveniently we can specify a file signer for repositories which don't have.
public JkMavenPublication setDefaultSigner(JkFileSigner defaultSigner)
getDefaultSigner()
public JkRepoSet getRepos()
public JkMavenPublication setRepos(JkRepoSet repoSet)
public JkMavenPublication addRepos(JkRepo... repoArgs)
setRepos(JkRepoSet)
public JkMavenPublication putArtifact(JkArtifactId artifactId, java.util.function.Consumer<java.nio.file.Path> artifactFileMaker)
artifactId
- The artifactId to add to publication.artifactFileMaker
- A Consumer
creating the artifact file at the provided location.public JkMavenPublication putArtifact(JkArtifactId artifactId)
publish()
will be invoked. If the artifact file is not present, an exception will be raised.public JkMavenPublication putArtifactIf(boolean condition, JkArtifactId artifactId)
publish()
will be invoked. If the artifact file is not present, an exception will be raised.public JkMavenPublication removeArtifact(JkArtifactId artifactId)
public JkMavenPublication publish()
public JkMavenPublication publishLocal()
public JkMavenPublication publishLocalM2()
public java.lang.String info()
JkMavenPublication
.public java.lang.String toString()
toString
in class java.lang.Object
public JkRepo findFirstNonLocalRepo()
public static JkDependencySet computeMavenPublishDependencies(JkDependencySet compileDeps, JkDependencySet runtimeDeps, JkCoordinate.ConflictStrategy strategy)