in src/main/java/org/apache/maven/plugins/jdeprscan/AbstractJDeprScanMojo.java [94:152]
private String getJDeprScanExecutable() throws IOException {
Toolchain tc = getToolchain();
String jdeprscanExecutable = null;
if (tc != null) {
jdeprscanExecutable = tc.findTool("jdeprscan");
}
String jdepsCommand = "jdeprscan" + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");
File jdeprscanExe;
if (StringUtils.isNotEmpty(jdeprscanExecutable)) {
jdeprscanExe = new File(jdeprscanExecutable);
if (jdeprscanExe.isDirectory()) {
jdeprscanExe = new File(jdeprscanExe, jdepsCommand);
}
if (SystemUtils.IS_OS_WINDOWS && jdeprscanExe.getName().indexOf('.') < 0) {
jdeprscanExe = new File(jdeprscanExe.getPath() + ".exe");
}
if (!jdeprscanExe.isFile()) {
throw new IOException(
"The jdeprscan executable '" + jdeprscanExe + "' doesn't exist or is not a file.");
}
return jdeprscanExe.getAbsolutePath();
}
jdeprscanExe =
new File(SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "sh", jdepsCommand);
// ----------------------------------------------------------------------
// Try to find jdepsExe from JAVA_HOME environment variable
// ----------------------------------------------------------------------
if (!jdeprscanExe.exists() || !jdeprscanExe.isFile()) {
Properties env = CommandLineUtils.getSystemEnvVars();
String javaHome = env.getProperty("JAVA_HOME");
if (StringUtils.isEmpty(javaHome)) {
throw new IOException("The environment variable JAVA_HOME is not correctly set.");
}
if ((!new File(javaHome).getCanonicalFile().exists())
|| (new File(javaHome).getCanonicalFile().isFile())) {
throw new IOException("The environment variable JAVA_HOME=" + javaHome
+ " doesn't exist or is not a valid directory.");
}
jdeprscanExe = new File(javaHome + File.separator + "bin", jdepsCommand);
}
if (!jdeprscanExe.getCanonicalFile().exists()
|| !jdeprscanExe.getCanonicalFile().isFile()) {
throw new IOException("The jdeps executable '" + jdeprscanExe
+ "' doesn't exist or is not a file. Verify the JAVA_HOME environment variable.");
}
return jdeprscanExe.getAbsolutePath();
}