99import java .nio .file .Paths ;
1010import java .text .MessageFormat ;
1111import java .util .*;
12+ import java .util .function .Predicate ;
1213import java .util .stream .Stream ;
1314
1415
@@ -29,7 +30,7 @@ public class BuildProject {
2930 * @return the maven command
3031 */
3132 public static String getMavenCommand () {
32- String mvnSystemCommand = Arrays .stream (System .getenv ("PATH" ).split (System . getProperty ( "path.separator" ) )).filter (Predicate .not (String ::isBlank )).filter (Predicate .not (String ::isEmpty )).map (path -> new File (path , System .getProperty ("os.name" ).toLowerCase ().contains ("windows" ) ? "mvn.cmd" : "mvn" )).filter (File ::exists ).findFirst ().map (File ::getAbsolutePath ).orElse (null );
33+ String mvnSystemCommand = Arrays .stream (System .getenv ("PATH" ).split (File . pathSeparator )).filter (Predicate .not (String ::isBlank )).filter (Predicate .not (String ::isEmpty )).map (path -> new File (path , System .getProperty ("os.name" ).toLowerCase ().contains ("windows" ) ? "mvn.cmd" : "mvn" )).filter (File ::exists ).findFirst ().map (File ::getAbsolutePath ).orElse (null );
3334 File mvnWrapper = System .getProperty ("os.name" ).toLowerCase ().contains ("windows" ) ? new File (projectRootPom , "mvnw.cmd" ) : new File (projectRootPom , "mvnw" );
3435 return commandExists (mvnWrapper .getAbsoluteFile ()).getKey () ? mvnWrapper .getAbsoluteFile ().toString () : mvnSystemCommand ;
3536 }
@@ -40,7 +41,7 @@ public static String getMavenCommand() {
4041 * @return the gradle command
4142 */
4243 public static String getGradleCommand () {
43- String gradleSystemCommand = Arrays .stream (System .getenv ("PATH" ).split (System . getProperty ( "path.separator" ) )).filter (Predicate .not (String ::isBlank )).filter (Predicate .not (String ::isEmpty )).map (path -> new File (path , System .getProperty ("os.name" ).toLowerCase ().contains ("windows" ) ? "gradle.bat" : "gradle" )).filter (File ::exists ).findFirst ().map (File ::getAbsolutePath ).orElse (null );
44+ String gradleSystemCommand = Arrays .stream (System .getenv ("PATH" ).split (File . pathSeparator )).filter (Predicate .not (String ::isBlank )).filter (Predicate .not (String ::isEmpty )).map (path -> new File (path , System .getProperty ("os.name" ).toLowerCase ().contains ("windows" ) ? "gradle.bat" : "gradle" )).filter (File ::exists ).findFirst ().map (File ::getAbsolutePath ).orElse (null );
4445 File gradleWrapper = System .getProperty ("os.name" ).toLowerCase ().contains ("windows" ) ? new File (projectRootPom , "gradlew.bat" ) : new File (projectRootPom , "gradlew" );
4546
4647 return commandExists (gradleWrapper .getAbsoluteFile ()).getKey () ? gradleWrapper .getAbsoluteFile () .toString () : gradleSystemCommand ;
0 commit comments