Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Maven vs Gradle-aware build dir #539

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
Original file line number Diff line number Diff line change
Expand Up @@ -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<Project> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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<Project> 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;
Expand Down
Loading