Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.IOException;
import java.text.MessageFormat;

import io.openliberty.tools.common.plugins.util.PluginExecutionException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
Expand Down Expand Up @@ -90,6 +91,11 @@ private void doDumpServer() throws MojoExecutionException {
serverTask.setOperation("dump");
serverTask.setArchive(archive);
serverTask.setInclude(generateInclude());
try {
checkAndEnablePosixRules(serverTask);
} catch (PluginExecutionException e) {
throw new MojoExecutionException("Error loading server properties from Liberty server directory.", e);
}
serverTask.execute();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
@Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class PackageServerMojo extends StartDebugMojoSupport {

public static final String MIN_SUPPORTED_VERSION_WITH_ARCHIVE_OPTION_POSIX_FORMAT = "25.0.0.11";

private enum PackageFileType {
JAR("jar"),
TAR("tar"),
Expand Down Expand Up @@ -171,13 +169,7 @@ private void doPackage() throws MojoExecutionException, IOException, PluginExecu
serverTask.setInclude(include);
serverTask.setOs(os);

List<InstallFeatureUtil.ProductProperties> propertiesList = InstallFeatureUtil.loadProperties(installDirectory);
String openLibertyVersion = InstallFeatureUtil.getOpenLibertyVersion(propertiesList);
if (openLibertyVersion != null &&
VersionUtility.compareArtifactVersion(openLibertyVersion,
MIN_SUPPORTED_VERSION_WITH_ARCHIVE_OPTION_POSIX_FORMAT, true) >= 0) {
serverTask.setUsePosixRules(true);
}
checkAndEnablePosixRules(serverTask);

serverTask.setServerRoot(serverRoot);
getLog().info(MessageFormat.format(messages.getString("info.server.package.file.location"), packageFile.getCanonicalPath()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import io.openliberty.tools.common.plugins.util.InstallFeatureUtil;
import io.openliberty.tools.common.plugins.util.PluginExecutionException;
import io.openliberty.tools.common.plugins.util.VersionUtility;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.versioning.ComparableVersion;
Expand Down Expand Up @@ -82,6 +85,7 @@ public abstract class StartDebugMojoSupport extends ServerFeatureSupport {

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

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

artifactToUpdate.setFile(outputDir.toFile());
}

/**
*
* @param serverTask
* @throws PluginExecutionException
*/
protected void checkAndEnablePosixRules(ServerTask serverTask) throws PluginExecutionException {
List<InstallFeatureUtil.ProductProperties> propertiesList = InstallFeatureUtil.loadProperties(installDirectory);
String openLibertyVersion = InstallFeatureUtil.getOpenLibertyVersion(propertiesList);
if (openLibertyVersion != null &&
VersionUtility.compareArtifactVersion(openLibertyVersion,
MIN_SUPPORTED_VERSION_WITH_ARCHIVE_OPTION_POSIX_FORMAT, true) >= 0) {
serverTask.setUsePosixRules(true);
}
}
}