Class JkPom

java.lang.Object
dev.jeka.core.api.tooling.maven.JkPom

public final class JkPom extends Object
Wraps a POM file (Ideally an effective POM file) and provides convenient methods to extract information on.
  • Method Details

    • of

      public static JkPom of(Path file)
      Creates a JkPom jump a POM file, ideally an effective POM file.
    • ofEffectivePom

      public static JkPom ofEffectivePom(JkCoordinate coordinate, JkRepoSet repoSet)
      Creates an effective POM representation for the specified Maven coordinate using the provided repository set.
      Parameters:
      coordinate - the Maven coordinate for which to generate the effective POM
      repoSet - the set of repositories to use for resolving dependencies and inheritance
      Returns:
      a JkPom instance representing the effective POM of the specified coordinate
    • getGroupId

      public String getGroupId()
      The groupId for this POM.
    • getParentGroupId

      public String getParentGroupId()
    • getArtifactId

      public String getArtifactId()
      The artifactId for this POM.
    • getVersion

      public String getVersion()
      The version for this POM.
    • getParentVersion

      public String getParentVersion()
    • getDependencies

      public JkQualifiedDependencySet getDependencies()
      The dependencies declared in this POM.
    • toVersionProvider

      public JkVersionProvider toVersionProvider(JkRepoSet repos)
      Converts the current POM representation into a JkVersionProvider, which manages version information for dependencies within the POM, including those defined in its dependency management section. If there is no dependency management section, an empty version provider is returned. Dependencies with a type of "pom" are identified as imported BOMs and are not included in the returned provider.

      Important: Ensure to use this method on an effectivePom (obtained with #toEffectivePom) to get full resolution.

      Returns:
      a JkVersionProvider containing the versions of dependencies defined in the dependency management section of the POM, or an empty provider if no such section exists.
    • getProperties

      public Map<String,String> getProperties()
      Returns properties declared in this POM.
    • getDependencyExclusion

      public dev.jeka.core.api.tooling.maven.DependencyExclusions getDependencyExclusion()
      The DependencyExclusions instance provided by the dependencyManagement section of this POM.
    • getRepos

      public JkRepoSet getRepos()
      Repositories declared in this POM.
    • toEffectivePom

      public JkPom toEffectivePom(JkRepoSet repos)
      Converts the current POM to its effective form, resolving any inherited or external dependencies using the specified repository set.
      Parameters:
      repos - the set of repositories to use for resolving dependencies and external properties
      Returns:
      the effective POM representation as a JkPom instance
    • toDocument

      public Document toDocument()
      Converts the current instance's underlying POM document into a DOM Document.
      Returns:
      a deep-cloned Document representation of the POM.