@auto-it/maven
Version:
Maven publishing plugin for auto
39 lines • 1.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.updatePoms = exports.executeReleaseGoals = void 0;
const core_1 = require("@auto-it/core");
const mavenDefaults = {
mavenCommand: "/usr/bin/mvn",
mavenOptions: [],
mavenReleaseGoals: ["deploy", "site-deploy"],
};
/** executes a maven command with all the options */
async function executeMaven(options, goals) {
const settingsParams = [
(options === null || options === void 0 ? void 0 : options.mavenSettings) ? `-s=${options.mavenSettings}` : "",
(options === null || options === void 0 ? void 0 : options.mavenUsername) ? `-Dusername=${options.mavenUsername}` : "",
(options === null || options === void 0 ? void 0 : options.mavenPassword) ? `-Dpassword=${options.mavenPassword}` : "",
];
return core_1.execPromise(options.mavenCommand || mavenDefaults.mavenCommand, [
...(options.mavenOptions || mavenDefaults.mavenOptions),
...goals,
...settingsParams,
]);
}
/** execute the built in release goals */
async function executeReleaseGoals(options) {
return executeMaven(options, options.mavenReleaseGoals || mavenDefaults.mavenReleaseGoals);
}
exports.executeReleaseGoals = executeReleaseGoals;
/** Update the pom with maven */
async function updatePoms(version, options, auto, message) {
auto.logger.verbose.info(`Using the versions-maven-plugin to set version = ${version}`);
await executeMaven(options, [
"versions:set",
"-DgenerateBackupPoms=false",
`-DnewVersion=${version}`,
]);
await core_1.execPromise("git", ["commit", "-am", message, "--no-verify"]);
}
exports.updatePoms = updatePoms;
//# sourceMappingURL=maven.js.map