import { PackageURL } from 'packageurl-js'; export type Provider = import('../provider').Provider; export type Provided = import('../provider').Provided; export type Package = { name: string; version: string; }; export type Dependency = { groupId: string; artifactId: string; version: string; scope: string; ignore: boolean; }; /** @typedef {import('../provider').Provider} Provider */ /** @typedef {import('../provider').Provided} Provided */ /** @typedef {{name: string, version: string}} Package */ /** @typedef {{groupId: string, artifactId: string, version: string, scope: string, ignore: boolean}} Dependency */ /** * @type {string} ecosystem for java maven packages. * @private */ export declare const ecosystem_maven: string; export declare const ecosystem_gradle = "gradle"; export default class Base_Java { DEP_REGEX: RegExp; CONFLICT_REGEX: RegExp; /** * Maven dependency scopes. Used to detect whether the trailing column of a * dependency-tree line is a scope keyword — which in turn signals that an * optional classifier column is present between the packaging and version. * @type {string[]} */ static MAVEN_SCOPES: string[]; globalBinary: string; localWrapper: string; /** * * @param {string} globalBinary name of the global binary * @param {string} localWrapper name of the local wrapper filename */ constructor(globalBinary: string, localWrapper: string); /** * Returns the package manager name (e.g. mvn, gradle) * @returns {string} */ packageManagerName(): string; /** * Recursively populates the SBOM instance with the parsed graph * @param {string} src - Source dependency to start the calculations from * @param {number} srcDepth - Current depth in the graph for the given source * @param {Array} lines - Array containing the text files being parsed * @param {Sbom} sbom - The SBOM where the dependencies are being added */ parseDependencyTree(src: string, srcDepth: number, lines: any[], sbom: Sbom): void; /** * Calculates how deep in the graph is the given line * @param {string} line - line to calculate the depth from * @returns {number} The calculated depth * @protected */ protected _getDepth(line: string): number; /** * Parse a single dependency-tree line into its Maven coordinate parts. * * This is the single source of truth for interpreting a dependency-tree * line. Both {@link parseDep} (used to build SBOM component PURLs) and the * Maven hash-map builder rely on it, so the PURL key and the artifact file * path can never drift from one another. * * A line has the shape `groupId:artifactId:packaging[:classifier]:version[:scope]`. * The classifier column is only present when a sixth column holds a known * Maven scope keyword; otherwise the fourth column is the version. * * @param {string} line - line to parse from a dependency tree * @returns {{groupId: string, artifactId: string, packaging: string, classifier: (string|null), version: string, scope: (string|null), overridden: boolean}} * Parsed coordinate. `version` is the resolved concrete version — when the * line carries a conflict override the override version replaces it and * `overridden` is set, mirroring how Maven records the winning version. */ parseCoordinate(line: string): { groupId: string; artifactId: string; packaging: string; classifier: (string | null); version: string; scope: (string | null); overridden: boolean; }; /** * Build the canonical PackageURL for a parsed coordinate. * * The classifier is folded into the version component (e.g. * `4.1.0-linux-x86_64`) except when the version came from a conflict * override, in which case the override version stands alone — matching the * historical behavior of {@link parseDep}. * * @param {{groupId: string, artifactId: string, classifier: (string|null), version: string, overridden: boolean}} coord * @returns {PackageURL} The canonical packageURL for the coordinate * @protected */ protected _coordinateToPurl(coord: { groupId: string; artifactId: string; classifier: (string | null); version: string; overridden: boolean; }): PackageURL; /** * Create a PackageURL from any line in a Text Graph dependency tree for a manifest path. * @param {string} line - line to parse from a dependencies.txt file * @returns {PackageURL} The parsed packageURL */ parseDep(line: string): PackageURL; /** * Returns a PackageUrl For Java maven dependencies * @param group * @param artifact * @param version * @return {PackageURL} */ toPurl(group: any, artifact: any, version: any): PackageURL; /** This method invokes command string in a process in a synchronous way. * Exists for stubbing in tests. * @param bin - the command to be invoked * @param args - the args to pass to the binary * @param {import('child_process').ExecFileOptionsWithStringEncoding} [opts={}] * @protected */ protected _invokeCommand(bin: any, args: any, opts?: import('child_process').ExecFileOptionsWithStringEncoding): string; /** * * @param {string} manifestPath * @param {{}} opts * @returns string */ selectToolBinary(manifestPath: string, opts: {}): string | null; }