You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.
When checkSystemPath is set to true and phantomjs is found, the phantomjs-maven-plugin sets the phantomjs.binary to "phantomjs" and not the actual path where phantomjs is located. This causes a problem when used with the Jasmine-Maven-Plugin and PhantomJsDriver. When PhantomJsDriver tries to locate the phantom binaries it tries new File("phantomjs"), and thus looking in the current directory, which will fail.
The following code can be used to retrieve the correct location on OSX/Linux:
private String getAbsolutePhantomPath() throws MojoExecutionException{
Commandline commandline = new Commandline("which");
commandline.createArg().setValue(PHANTOMJS);
try {
String path = extractString(commandline);
getLog().info("Phantomjs is installed in location"+path);
return path;
} catch (IOException e) {
throw new MojoExecutionException("Failed to locate phantom",e);
} catch (InterruptedException e) {
throw new MojoExecutionException("Failed to locate phantom", e);
}
}
private String extractString(Commandline commandline) throws IOException, InterruptedException{
Process process = new ProcessBuilder(commandline.getShellCommandline()).start();
BufferedReader standardOut = new BufferedReader(new InputStreamReader(process.getInputStream()));
String versionString = StringUtils.trim(standardOut.readLine());
int exitCode = process.waitFor();
if (exitCode != 0){
return null;
}
return versionString;
}
On windows, the "where" command could possibly be used instead of "which", but I haven't verified this.
The text was updated successfully, but these errors were encountered:
Good catch! Another way to tackle this would be to just implement it in java completely by just iterating through all the paths in the system PATH variable until we find one that has phantomjs binary in it. Not sure which way would be better. Definitely will get this fixed in the next release. Thanks.
When checkSystemPath is set to true and phantomjs is found, the phantomjs-maven-plugin sets the phantomjs.binary to "phantomjs" and not the actual path where phantomjs is located. This causes a problem when used with the Jasmine-Maven-Plugin and PhantomJsDriver. When PhantomJsDriver tries to locate the phantom binaries it tries new File("phantomjs"), and thus looking in the current directory, which will fail.
The following code can be used to retrieve the correct location on OSX/Linux:
On windows, the "where" command could possibly be used instead of "which", but I haven't verified this.
The text was updated successfully, but these errors were encountered: