Skip to content

Commit 7f7afa4

Browse files
authored
Merge pull request #254 from jGauravGupta/FISH-13145
FISH-13145 Fix Application deployment error
2 parents 75dce34 + 72d636c commit 7f7afa4

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

src/main/fish/payara/project/BuildSupport.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1818
*/
1919

20+
import * as path from 'path';
2021
import * as vscode from 'vscode';
21-
import { Uri } from "vscode";
22+
import { Uri, WorkspaceFolder } from "vscode";
2223
import { Build } from './Build';
2324
import { Maven } from './Maven';
2425
import { Gradle } from './Gradle';
@@ -35,8 +36,21 @@ export class BuildSupport {
3536
return new Maven(payaraInstance, workspace);
3637
} else if(Gradle.detect(workspace)){
3738
return new Gradle(payaraInstance, workspace);
38-
} else {
39-
throw new Error("Project build not supported for [" + uri.fsPath + "].");
39+
}
40+
// If build files not found at the workspace root, try the uri path itself.
41+
// This handles the case where the project is a subdirectory of the workspace.
42+
if(uri.fsPath !== workspace.uri.fsPath) {
43+
const projectWorkspace: WorkspaceFolder = {
44+
uri: uri,
45+
name: path.basename(uri.fsPath),
46+
index: workspace.index // inherit the parent workspace index; only uri is used for file operations
47+
};
48+
if(Maven.detect(projectWorkspace)){
49+
return new Maven(payaraInstance, projectWorkspace);
50+
} else if(Gradle.detect(projectWorkspace)){
51+
return new Gradle(payaraInstance, projectWorkspace);
52+
}
4053
}
54+
throw new Error("Project build not supported for [" + uri.fsPath + "].");
4155
}
4256
}

src/main/fish/payara/server/PayaraServerInstanceController.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -879,12 +879,19 @@ export class PayaraServerInstanceController extends PayaraInstanceController {
879879
} else if (servers.length === 1) {
880880
callback(servers[0]);
881881
} else {
882-
vscode.window.showQuickPick(servers, {
883-
placeHolder: 'Select the Payara Server',
884-
canPickMany: false
885-
}).then(value => {
886-
if (value instanceof PayaraServerInstance) {
887-
callback(value);
882+
vscode.window.showQuickPick(
883+
servers.map(server => ({
884+
label: server.getName(),
885+
description: `${server.getDomainName()}}`,
886+
server: server
887+
})),
888+
{
889+
placeHolder: 'Select the Payara Server',
890+
canPickMany: false
891+
}
892+
).then(item => {
893+
if (item) {
894+
callback(item.server);
888895
} else {
889896
vscode.window.showErrorMessage('Please select the Payara Server.');
890897
}

0 commit comments

Comments
 (0)