Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function doActivate(_operationId: string, context: vscode.ExtensionContext
item?.refresh ? item.refresh() : MavenExplorerProvider.getInstance().refresh(item);
});
registerCommandRequiringTrust(context, "maven.project.effectivePom", async (projectOrUri: Uri | MavenProject) => await Utils.showEffectivePom(projectOrUri));
registerCommandRequiringTrust(context, "maven.goal.custom", async (node: MavenProject) => await Utils.executeCustomGoal(node.pomPath));
registerCommandRequiringTrust(context, "maven.goal.custom", async (node: string | MavenProject, goal?: string) => await Utils.executeCustomGoal(node, goal));
registerCommand(context, "maven.project.openPom", openPomHandler);
// create project from archetype
registerCommand(context, "maven.archetype.generate", ArchetypeModule.createMavenProject);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class Utils {
return await window.withProgress({ location: ProgressLocation.Window }, task);
}

public static async executeCustomGoal(pomOrProject: string | MavenProject): Promise<void> {
public static async executeCustomGoal(pomOrProject: string | MavenProject, goal?: string): Promise<void> {
let pomPath: string | undefined;
if (typeof pomOrProject === "string") {
pomPath = pomOrProject;
Expand All @@ -180,10 +180,10 @@ export class Utils {
if (!pomPath) {
return;
}
const inputGoals: string | undefined = await window.showInputBox({ placeHolder: "e.g. clean package -DskipTests", ignoreFocusOut: true });
const inputGoals: string | undefined = goal || await window.showInputBox({ placeHolder: "e.g. clean package -DskipTests", ignoreFocusOut: true });
const trimmedGoals: string | undefined = inputGoals ? inputGoals.trim() : undefined;
if (trimmedGoals) {
await executeInTerminal({ command: trimmedGoals, pomfile: pomPath });
await executeInTerminal({ command: trimmedGoals, pomfile: pomPath, skipProblemMatching: true });
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/utils/mavenUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ export async function executeInTerminal(options: {
cwd?: string;
env?: { [key: string]: string };
terminalName?: string;
skipProblemMatching?: boolean;
}): Promise<vscode.Terminal | undefined> {
const { command, mvnPath, pomfile, cwd, env, terminalName } = options;
const { command, mvnPath, pomfile, cwd, env, terminalName, skipProblemMatching } = options;
const workspaceFolder: vscode.WorkspaceFolder | undefined = pomfile ? vscode.workspace.getWorkspaceFolder(vscode.Uri.file(pomfile)) : undefined;
const mvn: string | undefined = mvnPath ? mvnPath : await getMaven(pomfile);
if (mvn === undefined) {
Expand Down Expand Up @@ -172,8 +173,10 @@ export async function executeInTerminal(options: {
const terminal: vscode.Terminal = await mavenTerminal.runInTerminal(fullCommand, { name, cwd, env, workspaceFolder });
if (pomfile) {
await updateLRUCommands(command, pomfile);
// Also run in background to capture output for problem matching
executeInBackground(command, pomfile).catch(() => {/* ignore errors, just for problem matching */});
if (!skipProblemMatching) {
// Also run in background to capture output for problem matching
executeInBackground(command, pomfile).catch(() => {/* ignore errors, just for problem matching */});
}
}
return terminal;
}
Expand Down
Loading