Skip to content

Commit 68c12b3

Browse files
committed
Prototype installing interim fixes
1 parent b7ff292 commit 68c12b3

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

.github/workflows/maven.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ jobs:
5353
- name: Checkout ci.ant
5454
uses: actions/checkout@v3
5555
with:
56-
repository: OpenLiberty/ci.ant
56+
repository: cherylking/ci.ant
57+
ref: addIfixSupport
5758
path: ci.ant
5859
- name: Set up Maven
5960
uses: stCarolas/[email protected]
@@ -99,7 +100,7 @@ jobs:
99100
run: |
100101
cp -r D:/a/ci.maven/ci.maven C:/ci.maven
101102
git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common
102-
git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant
103+
git clone https://github.com/cherylking/ci.ant.git --branch addIfixSupport --single-branch C:/ci.ant
103104
- name: Set up Maven
104105
uses: stCarolas/[email protected]
105106
with:

liberty-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>io.openliberty.tools</groupId>
3939
<artifactId>liberty-ant-tasks</artifactId>
40-
<version>1.9.13</version>
40+
<version>1.9.14-SNAPSHOT</version>
4141
</dependency>
4242
<dependency>
4343
<groupId>org.apache.maven</groupId>

liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/BasicSupport.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.codehaus.plexus.util.FileUtils;
4444
import org.codehaus.plexus.util.IOUtil;
4545

46+
import io.openliberty.tools.ant.InstallLibertyInterimFixTask;
4647
import io.openliberty.tools.ant.install.InstallLibertyTask;
4748
import io.openliberty.tools.common.plugins.util.ServerFeatureUtil;
4849

@@ -93,6 +94,12 @@ public abstract class BasicSupport extends AbstractLibertySupport {
9394
@Parameter(property = "installDirectory")
9495
protected File installDirectory;
9596

97+
/**
98+
* Directory containing interim fixes.
99+
*/
100+
@Parameter(property = "interimFixDirectory")
101+
protected File interimFixDirectory;
102+
96103
/**
97104
* Liberty server name, default is defaultServer
98105
*/
@@ -443,6 +450,7 @@ protected void installServerAssembly() throws MojoExecutionException, IOExceptio
443450
installFromFile();
444451
}
445452
installLicense();
453+
installInterimFixes(installDirectory, interimFixDirectory);
446454
}
447455
}
448456

@@ -575,6 +583,41 @@ protected void installLicense() throws MojoExecutionException, IOException {
575583
}
576584
}
577585

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+
}
578621
/*
579622
* Handle cleaning up all three possible locations for applications, and check for both stripped and non-stripped file name in
580623
* case that setting has been modified.

liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/ExecuteMojoUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public class ExecuteMojoUtil {
201201
"version"));
202202

203203
private static final ArrayList<String> LIBERTY_COMMON_PARAMS = new ArrayList<>(Arrays.asList(
204-
"installDirectory", "assemblyArchive", "assemblyArtifact", "libertyRuntimeVersion",
204+
"installDirectory", "interimFixDirectory", "assemblyArchive", "assemblyArtifact", "libertyRuntimeVersion",
205205
"install", "licenseArtifact", "serverName", "userDirectory", "outputDirectory",
206206
"assemblyInstallDirectory", "refresh", "skip", "serverXmlFile", "configDirectory",
207207
"serverEnvFile", "mergeServerEnv"

0 commit comments

Comments
 (0)