Skip to content

Added mvn clean option under liberty in run configuration#572

Merged
JoshwinThomasIBM merged 12 commits intoOpenLiberty:mainfrom
JoshwinThomasIBM:ProjectCleanFinalPRBranch
May 7, 2025
Merged

Added mvn clean option under liberty in run configuration#572
JoshwinThomasIBM merged 12 commits intoOpenLiberty:mainfrom
JoshwinThomasIBM:ProjectCleanFinalPRBranch

Conversation

@JoshwinThomasIBM
Copy link
Contributor

Fixes #239

changes includes :
Adding a new check box to enable project clean option under liberty in run configurations .
Test cases for the new Run project clean check box added for both Gradle and maven projects

Copy link
Contributor

@awisniew90 awisniew90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the trace block starting on line 270 in StartTab.java - can you add the new clean option value to the print out?

Copy link
Contributor

@awisniew90 awisniew90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had one suggestion to have the --stop command as part of the same libertyDev command (if it works).

Also, I think the slight performance hit is OK given that the user is specifically requesting to do a clean start which probably wouldnt be done often.

} else if (buildType == Project.BuildType.GRADLE) {
cmd = CommandBuilder.getGradleCommandLine(projectPath, "libertyDev " + startParms, pathEnv);
if (runProjectClean == true) {
// Step 1: Run gradle --stop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the gradle stop as part of the same command as the start? So for example:
./gradlew --stop && ./gradlew clean libertyDev or even ./graldew --stop clean libertyDev

Not sure if that last one will work, but the first should, I think. By running the process separately, we have a system process showing in the debug UI that seems a bit awkward:
Screenshot 2025-04-28 at 11 37 08 AM

Copy link
Contributor

@awisniew90 awisniew90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work - No longer seeing the gradle stop process attached to the Launch. Had some review comments

} else {
command = Arrays.asList("/bin/sh", "-c", "./gradlew --stop");
}
System.out.println("--stop command ::"+command);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove these print statements. Instead you can use the Logger which will write to the plugin's log file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

List<String> command;

if (Utils.isWindows()) {
command = Arrays.asList("cmd.exe", "/c", "gradlew.bat --stop");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to resolve the Gradle executable the same way we do when running the dev mode command. This may or may not be a wrapper file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

}
if (runProjectClean == true) {
stopGradleDaemon(projectPath);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few spots where the formatting is off (use 4 spaces instead of Tab). You can run the formatter in Eclipse to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

if (exitCode == 0 && output.toString().contains("Stopping Daemon")) {
System.out.println("Gradle daemon stopped successfully.");
} else {
System.err.println("Gradle --stop may have failed. Exit code: " + exitCode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we can probably remove all of the print statements. These will show up in the plugin's log file (not in the console of the process), and most likely wont be seen. We can probably just have one error message (using Logger.logError() ) in case the stop of the daemon fails. e.g. "An attempt to stop the Gradle daemon failed...."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

Copy link
Contributor

@awisniew90 awisniew90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - great work!

@JoshwinThomasIBM JoshwinThomasIBM merged commit b3911e2 into OpenLiberty:main May 7, 2025
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide option on Run Config to do a 'clean' before running dev mode

2 participants