Skip to content

Commit ad750f0

Browse files
authored
Merge pull request #1956 from venmanyarun/dump_archive_option
changes to add posix rules for archive option
2 parents 56d8228 + 0aad5c6 commit ad750f0

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.IOException;
2020
import java.text.MessageFormat;
2121

22+
import io.openliberty.tools.common.plugins.util.PluginExecutionException;
2223
import org.apache.maven.plugin.MojoExecutionException;
2324
import org.apache.maven.plugins.annotations.Mojo;
2425
import org.apache.maven.plugins.annotations.Parameter;
@@ -90,6 +91,11 @@ private void doDumpServer() throws MojoExecutionException {
9091
serverTask.setOperation("dump");
9192
serverTask.setArchive(archive);
9293
serverTask.setInclude(generateInclude());
94+
try {
95+
checkAndEnablePosixRules(serverTask);
96+
} catch (PluginExecutionException e) {
97+
throw new MojoExecutionException("Error loading server properties from Liberty server directory.", e);
98+
}
9399
serverTask.execute();
94100
}
95101

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
@Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
4343
public class PackageServerMojo extends StartDebugMojoSupport {
4444

45-
public static final String MIN_SUPPORTED_VERSION_WITH_ARCHIVE_OPTION_POSIX_FORMAT = "25.0.0.11";
46-
4745
private enum PackageFileType {
4846
JAR("jar"),
4947
TAR("tar"),
@@ -171,13 +169,7 @@ private void doPackage() throws MojoExecutionException, IOException, PluginExecu
171169
serverTask.setInclude(include);
172170
serverTask.setOs(os);
173171

174-
List<InstallFeatureUtil.ProductProperties> propertiesList = InstallFeatureUtil.loadProperties(installDirectory);
175-
String openLibertyVersion = InstallFeatureUtil.getOpenLibertyVersion(propertiesList);
176-
if (openLibertyVersion != null &&
177-
VersionUtility.compareArtifactVersion(openLibertyVersion,
178-
MIN_SUPPORTED_VERSION_WITH_ARCHIVE_OPTION_POSIX_FORMAT, true) >= 0) {
179-
serverTask.setUsePosixRules(true);
180-
}
172+
checkAndEnablePosixRules(serverTask);
181173

182174
serverTask.setServerRoot(serverRoot);
183175
getLog().info(MessageFormat.format(messages.getString("info.server.package.file.location"), packageFile.getCanonicalPath()));

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
import javax.xml.parsers.ParserConfigurationException;
4747
import javax.xml.transform.TransformerException;
4848

49+
import io.openliberty.tools.common.plugins.util.InstallFeatureUtil;
50+
import io.openliberty.tools.common.plugins.util.PluginExecutionException;
51+
import io.openliberty.tools.common.plugins.util.VersionUtility;
4952
import org.apache.commons.lang3.ObjectUtils;
5053
import org.apache.maven.artifact.Artifact;
5154
import org.apache.maven.artifact.versioning.ComparableVersion;
@@ -82,6 +85,7 @@ public abstract class StartDebugMojoSupport extends ServerFeatureSupport {
8285

8386
protected final String PLUGIN_VARIABLE_CONFIG_OVERRIDES_XML = "configDropins/overrides/liberty-plugin-variable-config.xml";
8487
protected final String PLUGIN_VARIABLE_CONFIG_DEFAULTS_XML = "configDropins/defaults/liberty-plugin-variable-config.xml";
88+
protected static final String MIN_SUPPORTED_VERSION_WITH_ARCHIVE_OPTION_POSIX_FORMAT = "25.0.0.11";
8589

8690
protected Map<String,String> bootstrapMavenProps = new HashMap<String,String>();
8791
protected Map<String,String> envMavenProps = new HashMap<String,String>();
@@ -1103,4 +1107,19 @@ protected void updateArtifactPathToOutputDirectory(MavenProject mavenProject, Ar
11031107

11041108
artifactToUpdate.setFile(outputDir.toFile());
11051109
}
1110+
1111+
/**
1112+
*
1113+
* @param serverTask
1114+
* @throws PluginExecutionException
1115+
*/
1116+
protected void checkAndEnablePosixRules(ServerTask serverTask) throws PluginExecutionException {
1117+
List<InstallFeatureUtil.ProductProperties> propertiesList = InstallFeatureUtil.loadProperties(installDirectory);
1118+
String openLibertyVersion = InstallFeatureUtil.getOpenLibertyVersion(propertiesList);
1119+
if (openLibertyVersion != null &&
1120+
VersionUtility.compareArtifactVersion(openLibertyVersion,
1121+
MIN_SUPPORTED_VERSION_WITH_ARCHIVE_OPTION_POSIX_FORMAT, true) >= 0) {
1122+
serverTask.setUsePosixRules(true);
1123+
}
1124+
}
11061125
}

0 commit comments

Comments
 (0)