Closed scottkurz closed 14 hours ago
Note that this is considered a "must fix" for GA. Please update with an outlook @rahlk. Thanks.
Should be an easy fix. I'll make a 1.0.2 release where we look for mvnw wrapper similar to gradlew.
Please note that there is a flag called --build-cmd
to provide any arbitrary build command to build an application.
Adding some feedback here... I tried out the mvnw function in the 1.0.2 release, but there are a few issues, particularly in BuildProject.java
private static final String MAVEN_CMD = System.getProperty("os.name").toLowerCase().contains("windows")
? (new File("mvnw.cmd").exists() ? "mvnw.cmd" : "mvn.cmd")
: (new File("mvnw").exists() ? "mvnw" : "mvn");
Without this, the check for wrapper existence depends on being in a specific working directory, and the mvnw invocation fails regardless of which directory the command is run from since mvnw is treated as a system executable and not a local script.
Hi @awisniew90, as per you suggestion, I have added the following patch in release 1.0.4:
private static final String MAVEN_CMD = BuildProject.getMavenCommand();
private static String getMavenCommand() {
Boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String mvnCommand;
if (isWindows) {
mvnCommand = new File(projectRootPom, "mvnw.bat").exists() ? String.valueOf(new File(projectRootPom, "mvnw.bat")) : "mvn.bat";
} else {
mvnCommand = new File(projectRootPom, "mvnw").exists() ? String.valueOf(new File(projectRootPom, "mvnw")) : "mvn";
}
return mvnCommand;
}
Verify compatibility and close issue if resolved.
Fix is working on CA 1.0.4 and properly using maven wrapper
2024-11-12T11:37:06.743833[0m[35m [INFO] [0mFound pom.xml in the project directory. Using Maven to download dependencies.
[36m2024-11-12T11:37:06.749503[0m[35m [INFO] [0mBuilding the project using /Users/awisniew/Projects/WCA4J/multi-module-modresorts/mvnw.
[36m2024-11-12T11:37:07.632651[0m[35m [INFO] [0m[INFO] Scanning for projects...
[36m2024-11-12T11:37:07.659549[0m[35m [INFO] [0m[INFO] ------------------------------------------------------------------------
[36m2024-11-12T11:37:07.659621[0m[35m [INFO] [0m[INFO] Reactor Build Order:
[36m2024-11-12T11:37:07.659652[0m[35m [INFO] [0m[INFO]
[36m2024-11-12T11:37:07.659963[0m[35m [INFO] [0m[INFO] ModResorts [war]
[36m2024-11-12T11:37:07.660021[0m[35m [INFO] [0m[INFO] modresorts-pom [pom]
@rahlk - I dont have access to close the issue, but please do so
Great! Thanks @awisniew90. Closing this issue.
The 'mvn' invocation assumes mvn/mvn.cmd is available from the PATH env var, even for a
--no-build
scenario (to copy deps).More flexible would be to:
--build-tool-exe <path to Maven/Gradle executable or wrapper>
If that is too much, perhaps simply looking for a mvnw in the project root would be a shorter-term enhancement.