MCPcopy Create free account
hub / github.com/SAP/ui5-project / _getPom

Method _getPom

lib/specifications/ComponentProject.js:352–377  ·  view source on GitHub ↗

* Reads the projects pom.xml file * * @returns {Promise } Resolves with a JSON representation of the content

()

Source from the content-addressed store, hash-verified

350 * @returns {Promise<object>} Resolves with a JSON representation of the content
351 */
352 async _getPom() {
353 if (this._pPom) {
354 return this._pPom;
355 }
356
357 return this._pPom = this.getRootReader().byPath("/pom.xml")
358 .then(async (resource) => {
359 if (!resource) {
360 throw new Error(
361 `Could not find pom.xml in project ${this.getName()}`);
362 }
363 const content = await resource.getString();
364 const {
365 default: xml2js
366 } = await import("xml2js");
367 const parser = new xml2js.Parser({
368 explicitArray: false,
369 ignoreAttrs: true
370 });
371 const readXML = promisify(parser.parseString);
372 return readXML(content);
373 }).catch((err) => {
374 throw new Error(
375 `Failed to read pom.xml for project ${this.getName()}: ${err.message}`);
376 });
377 }
378}
379
380export default ComponentProject;

Callers 2

Calls 2

getRootReaderMethod · 0.80
getNameMethod · 0.45

Tested by

no test coverage detected