diff --git a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java index 690a3290..da94a3ac 100644 --- a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java +++ b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/DevModeOperations.java @@ -992,11 +992,40 @@ public static Path getMavenIntegrationTestReportPath(String projectPath, String return path1.toFile().exists() ? path1 : path2; } - public Path getLibertyPluginConfigXmlPath(String projectPath) { - Path path = Paths.get(projectPath, "target", "liberty-plugin-config.xml"); - + public Path getLibertyPluginConfigXmlPath(Project project) throws Exception { + + Project serverProj = getLibertyServerProject(project); + String buildDir = serverProj.getBuildType() == BuildType.GRADLE ? "build" : "target"; + + Path path = Paths.get(serverProj.getPath(), buildDir, "liberty-plugin-config.xml"); return path; } + + + /** + * Returns the liberty server module project associated with the input project. + * + * @param project The project to process. + * + * @return The liberty server module project associated with the input project. + * + * @throws Exception + */ + private Project getLibertyServerProject(Project project) throws Exception { + if (project.isParentOfServerModule()) { + List mmps = project.getChildLibertyServerProjects(); + switch (mmps.size()) { + case 0: + throw new Exception("Unable to find a child project that contains the Liberty server configuration."); + case 1: + return mmps.get(0); + default: + throw new Exception("Multiple child projects containing Liberty server configuration were found."); + } + } + + return project; + } /** * Returns the path of the HTML file containing the unit test report. diff --git a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/DebugModeHandler.java b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/DebugModeHandler.java index cbb5abf6..b8146beb 100644 --- a/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/DebugModeHandler.java +++ b/bundles/io.openliberty.tools.eclipse.ui/src/io/openliberty/tools/eclipse/debug/DebugModeHandler.java @@ -514,10 +514,9 @@ private void openDebugPerspective() { */ private Path getServerEnvFile(Project project) throws Exception { - Project serverProj = getLibertyServerProject(project); - String projectPath = serverProj.getPath(); + - Path libertyPluginConfigXmlPath = devModeOps.getLibertyPluginConfigXmlPath(projectPath); + Path libertyPluginConfigXmlPath = devModeOps.getLibertyPluginConfigXmlPath(project); // Read server.env path from liberty-plugin-config.xml @@ -642,30 +641,6 @@ public void run() { + ". If the server starts later you might try to manually create a Remote Java Application debug configuration and attach to the server. You can confirm the debug port used in the terminal output looking for a message like 'Liberty debug port: [ 63624 ]'."); } - /** - * Returns the liberty server module project associated with the input project. - * - * @param project The project to process. - * - * @return The liberty server module project associated with the input project. - * - * @throws Exception - */ - private Project getLibertyServerProject(Project project) throws Exception { - if (project.isParentOfServerModule()) { - List mmps = project.getChildLibertyServerProjects(); - switch (mmps.size()) { - case 0: - throw new Exception("Unable to find a child project that contains the Liberty server configuration."); - case 1: - return mmps.get(0); - default: - throw new Exception("Multiple child projects containing Liberty server configuration were found."); - } - } - - return project; - } private class DataHolder { boolean closed;