Skip to content

Commit

Permalink
Fixed Ant home resolution and PATH
Browse files Browse the repository at this point in the history
Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Nov 18, 2022
1 parent 12c1191 commit 4fd2996
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Expand Up @@ -125,10 +125,18 @@ public File getJdkDirectory() {


/**
* Resolves to the first value set:
* <ol>
* <li>System property ant.home (set in command line or Maven profile)
* <li>Environment property ANT_HOME (set in bash environment and resolved via pom.xml)
* <li>Default /usr/share/ant
* </ol>
*
* @return Ant home directory (note: 1.9.14 recommended)
*/
public File getAntDirectory() {
return new File(cfg.getProperty("ant.directory"));
final String antHome = cfg.getProperty("ant.directory");
return new File(antHome == null || antHome.isEmpty() || antHome.startsWith("$") ? "/usr/share/ant" : antHome);
}


Expand Down
Expand Up @@ -203,8 +203,11 @@ private void configureEnvironment(Map<String, String> env) {
env.put("HARNESS_DEBUG", String.valueOf(cfg.isHarnessLoggingEnabled()));
env.put("AS_DEBUG", String.valueOf(cfg.isAsadminLoggingEnabled()));

env.put("PATH", cfg.getJdkDirectory().getAbsolutePath() + "/bin:" + cfg.getAntDirectory().getAbsolutePath()
+ "/bin/:/usr/bin");
env.put("PATH", String.join(":",
cfg.getJdkDirectory().getAbsolutePath() + "/bin",
cfg.getAntDirectory().getAbsolutePath() + "/bin",
"/usr/bin",
"/bin"));
env.put("CTS_HOME", cfg.getTargetDir().getAbsolutePath());
env.put("TS_HOME", cfg.getJakartaeeDir().getAbsolutePath());
env.put("GF_BUNDLE_ZIP", this.glassfishZip.getAbsolutePath());
Expand Down

0 comments on commit 4fd2996

Please sign in to comment.