Class JkMavenPublication
java.lang.Object
dev.jeka.core.api.depmanagement.publication.JkMavenPublication
Publication specific information to include in POM file in order to be published of a Maven repository.
This information contains :
- The artifacts to be published (main artifact and artifacts with classifiers)
- Information about describing the project as some public repositories require
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal JkPomMetadataRepresents the Maven metadata for a publication.final JkRunnablesCollection of runnables that are executed after publishing to M2 repos.final JkRunnablesCollection of runnables that are executed before publishing to M2 repos. -
Method Summary
Modifier and TypeMethodDescriptionaddManagedDependenciesInPom(String moduleId, String version) Adds the specified moduleId and version in the dependencyManagement of the POM file to be published.Adds the specified repositories to the publication repositories.static JkDependencySetcomputeMavenPublishDependencies(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.copy()Configure the dependencies that will be exported with the published module.
By default, JeKa computes it from the compile and runtime dependencies.Shorthand to get the first declared publication repository.Returns the default file signer for this publication.Returns the dependencies to be included in POM as transitive dependencies.Returns the moduleId (group + artifact name) for this publication.getRepos()Returns the repositories where this publication will be published.Returns the version of the artifacts for this publication.info()Returns a string representation of the information for thisJkMavenPublication.static JkMavenPublicationof(JkArtifactLocator artifactLocator) Creates aJkMavenPublicationwith the specified artifact locator.static JkMavenPublicationof(JkBuildable buildable) Creates aJkMavenPublicationfor a given buildable object, configuring it based on the specified buildable's properties such as artifacts, module information, version, dependencies, and repositories.static JkMavenPublicationCreates aJkMavenPublicationthat can contains only a POM, and no artifacts.publish()Publishes this publication to its defined repositoriesPublishes this publication on the JeKa local repositoryPublishes this publication on the M2 local repositoryputArtifact(JkArtifactId artifactId) Adds the specified artifact to the publication assuming the artifact file will exist whenpublish()will be invoked.putArtifact(JkArtifactId artifactId, Consumer<Path> artifactFileMaker) Adds the specified artifact to the publication.putArtifactIf(boolean condition, JkArtifactId artifactId) Adds the specified artifact to the publication assuming the artifact file will exist whenpublish()will be invoked.Removes all published artifacts.removeArtifact(JkArtifactId artifactId) Removes the specified artifact from this publication.setBomResolutionRepos(Supplier<JkRepoSet> repoSupplier) Sets the supplier providing the download repositories used to resolve BOMs.setDefaultSigner(JkFileSigner defaultSigner) Sets the default file signer to use for this publication.setModuleId(String moduleId) Sets the moduleId (group + artifactName) for this publication.setModuleIdSupplier(Supplier<JkModuleId> moduleIdSupplier) Sets the supplier providing the moduleId (group + artifactName) for this publication.Configures the publication to include only the POM file, without any additional artifacts.Sets the repositories where this publication will be published.setVersion(String version) Sets the version of the artifacts to publish.setVersionSupplier(Supplier<JkVersion> versionSupplier) Sets the supplier providing the version of the artifacts to publish.toString()
-
Field Details
-
pomMetadata
Represents the Maven metadata for a publication. -
preActions
Collection of runnables that are executed before publishing to M2 repos. -
postActions
Collection of runnables that are executed after publishing to M2 repos.
-
-
Method Details
-
of
Creates aJkMavenPublicationwith the specified artifact locator.- Parameters:
artifactLocator- The artifact locator for locating the artifact files to publish.
-
of
Creates aJkMavenPublicationfor a given buildable object, configuring it based on the specified buildable's properties such as artifacts, module information, version, dependencies, and repositories.- Parameters:
buildable- The buildable object used to configure the Maven publication.- Returns:
- A configured
JkMavenPublicationinstance based on the given buildable object.
-
ofPomOnly
Creates aJkMavenPublicationthat can contains only a POM, and no artifacts. The typical usage is to publish BOMs. -
copy
-
setPomPublicationOnly
Configures the publication to include only the POM file, without any additional artifacts. This is typically used for scenarios such as creating and publishing Bill of Materials (BOM) files. -
customizeDependencies
Configure the dependencies that will be exported with the published module.
By default, JeKa computes it from the compile and runtime dependencies. This method allows to customize these dependencies by adding/removing or changing their transitivity. -
addManagedDependenciesInPom
Adds the specified moduleId and version in the dependencyManagement of the POM file to be published. This is the way to create BOM file. -
getDependencies
Returns the dependencies to be included in POM as transitive dependencies. -
setModuleIdSupplier
Sets the supplier providing the moduleId (group + artifactName) for this publication. -
setModuleId
Sets the moduleId (group + artifactName) for this publication.- See Also:
-
setVersionSupplier
Sets the supplier providing the version of the artifacts to publish. -
setVersion
Sets the version of the artifacts to publish.- See Also:
-
setBomResolutionRepos
Sets the supplier providing the download repositories used to resolve BOMs. -
getModuleId
Returns the moduleId (group + artifact name) for this publication. -
getVersion
Returns the version of the artifacts for this publication. -
getDefaultSigner
Returns the default file signer for this publication.Normally, each publish repository can define its own signer. Conveniently we can specify a file signer for repositories which don't have.
-
setDefaultSigner
Sets the default file signer to use for this publication.- See Also:
-
getRepos
Returns the repositories where this publication will be published. -
setRepos
Sets the repositories where this publication will be published. -
addRepos
Adds the specified repositories to the publication repositories.- See Also:
-
putArtifact
Adds the specified artifact to the publication. If the artifact file is not present, this one will be created using the specified artifact file maker.- Parameters:
artifactId- The artifactId to add to publication.artifactFileMaker- AConsumercreating the artifact file at the provided location.
-
putArtifact
Adds the specified artifact to the publication assuming the artifact file will exist whenpublish()will be invoked. If the artifact file is not present, an exception will be raised. -
putArtifactIf
Adds the specified artifact to the publication assuming the artifact file will exist whenpublish()will be invoked. If the artifact file is not present, an exception will be raised. -
removeArtifact
Removes the specified artifact from this publication. -
removeAllArtifacts
Removes all published artifacts. Suitable for publishing POM only. -
publish
Publishes this publication to its defined repositories -
publishLocal
Publishes this publication on the JeKa local repository -
publishLocalM2
Publishes this publication on the M2 local repository -
info
Returns a string representation of the information for thisJkMavenPublication. -
toString
-
findFirstNonLocalRepo
Shorthand to get the first declared publication repository. -
computeMavenPublishDependencies
public 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.
-