|
43 | 43 | import org.codehaus.plexus.util.FileUtils;
|
44 | 44 | import org.codehaus.plexus.util.IOUtil;
|
45 | 45 |
|
| 46 | +import io.openliberty.tools.ant.InstallLibertyInterimFixTask; |
46 | 47 | import io.openliberty.tools.ant.install.InstallLibertyTask;
|
47 | 48 | import io.openliberty.tools.common.plugins.util.ServerFeatureUtil;
|
48 | 49 |
|
@@ -93,6 +94,12 @@ public abstract class BasicSupport extends AbstractLibertySupport {
|
93 | 94 | @Parameter(property = "installDirectory")
|
94 | 95 | protected File installDirectory;
|
95 | 96 |
|
| 97 | + /** |
| 98 | + * Directory containing interim fixes. |
| 99 | + */ |
| 100 | + @Parameter(property = "interimFixDirectory") |
| 101 | + protected File interimFixDirectory; |
| 102 | + |
96 | 103 | /**
|
97 | 104 | * Liberty server name, default is defaultServer
|
98 | 105 | */
|
@@ -443,6 +450,7 @@ protected void installServerAssembly() throws MojoExecutionException, IOExceptio
|
443 | 450 | installFromFile();
|
444 | 451 | }
|
445 | 452 | installLicense();
|
| 453 | + installInterimFixes(installDirectory, interimFixDirectory); |
446 | 454 | }
|
447 | 455 | }
|
448 | 456 |
|
@@ -575,6 +583,41 @@ protected void installLicense() throws MojoExecutionException, IOException {
|
575 | 583 | }
|
576 | 584 | }
|
577 | 585 |
|
| 586 | + /** |
| 587 | + * Executes the InstallLibertyInterimFixTask to install interim fixes located in the specified interimFixDirectory. |
| 588 | + * |
| 589 | + * @param installDirectory |
| 590 | + * : Installation directory of Liberty profile. |
| 591 | + * @param interimFixDirectory |
| 592 | + * : Directory containing interim fixes |
| 593 | + */ |
| 594 | + protected void installInterimFixes(File installDirectory, File interimFixDirectory) throws MojoExecutionException, IOException { |
| 595 | + if (interimFixDirectory == null) { |
| 596 | + return; |
| 597 | + } else if (!interimFixDirectory.isDirectory()) { |
| 598 | + getLog().warn("The interimFixDirectory is not a directory or does not exist. Interim fixes will not be installed."); |
| 599 | + return; |
| 600 | + } |
| 601 | + |
| 602 | + getLog().info("Installing interim fixes..."); |
| 603 | + io.openliberty.tools.ant.InstallLibertyInterimFixTask iFixTask = (InstallLibertyInterimFixTask) ant |
| 604 | + .createTask("antlib:io/openliberty/tools/ant:install-fix"); |
| 605 | + if (iFixTask == null) { |
| 606 | + throw new IllegalStateException( |
| 607 | + MessageFormat.format(messages.getString("error.dependencies.not.found"), "install-fix")); |
| 608 | + } |
| 609 | + |
| 610 | + iFixTask.setInstallDir(installDirectory); |
| 611 | + iFixTask.setInterimFixDirectory(interimFixDirectory); |
| 612 | + iFixTask.setSuppressInfo(false); |
| 613 | + |
| 614 | + try { |
| 615 | + iFixTask.execute(); |
| 616 | + } catch (Exception e) { |
| 617 | + getLog().warn("An error occurred when installing the Liberty interim fixes: "+e.getMessage()); |
| 618 | + getLog().debug("Exception received: "+e.getMessage(), (Throwable) e); |
| 619 | + } |
| 620 | + } |
578 | 621 | /*
|
579 | 622 | * Handle cleaning up all three possible locations for applications, and check for both stripped and non-stripped file name in
|
580 | 623 | * case that setting has been modified.
|
|
0 commit comments