Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFMP-265] Default the bootable JAR name to be the artifact ID + "-bo… #579

Merged
merged 1 commit into from
Oct 8, 2024
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 @@ -53,7 +53,9 @@
@Mojo(name = "package", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PACKAGE)
public class PackageServerMojo extends AbstractProvisionServerMojo {

@Deprecated(forRemoval = true, since = "5.1")
public static final String JAR = "jar";
@Deprecated(forRemoval = true, since = "5.1")
public static final String BOOTABLE_JAR_NAME_RADICAL = "server-";

/**
Expand Down Expand Up @@ -242,11 +244,14 @@ public class PackageServerMojo extends AbstractProvisionServerMojo {

/**
* When {@code bootable-jar} is set to true, use this parameter to name the generated jar file.
* The jar file is named by default {@code server-bootable.jar}.
* <p>
* Note that since 5.1 the default name changed from {@code server-bootable.jar} to
* {@code ${project.artifactId}-bootable.jar}.
* </p>
*
* @since 5.0
*/
@Parameter(alias = "bootable-jar-name", required = false, property = PropertyNames.BOOTABLE_JAR_NAME)
@Parameter(alias = "bootable-jar-name", property = PropertyNames.BOOTABLE_JAR_NAME, defaultValue = "${project.artifactId}-bootable.jar")
private String bootableJarName;

/**
Expand Down Expand Up @@ -385,12 +390,11 @@ private void attachJar(Path jarFile) {
getLog().debug("Attaching bootable jar " + jarFile + " as a project artifact with classifier "
+ bootableJarInstallArtifactClassifier);
}
projectHelper.attachArtifact(project, JAR, bootableJarInstallArtifactClassifier, jarFile.toFile());
projectHelper.attachArtifact(project, "jar", bootableJarInstallArtifactClassifier, jarFile.toFile());
}

private void packageBootableJar(Path jbossHome, GalleonProvisioningConfig activeConfig) throws Exception {
String jarName = bootableJarName == null ? BOOTABLE_JAR_NAME_RADICAL + BootableJarSupport.BOOTABLE_SUFFIX + "." + JAR
: bootableJarName;
String jarName = bootableJarName;
Path targetPath = Paths.get(project.getBuild().getDirectory());
Path targetJarFile = targetPath.toAbsolutePath()
.resolve(jarName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.wildfly.plugin.common.PropertyNames;
import org.wildfly.plugin.common.StandardOutput;
import org.wildfly.plugin.common.Utils;
import org.wildfly.plugin.provision.PackageServerMojo;
import org.wildfly.plugin.tools.bootablejar.BootableJarSupport;

/**
* Starts a WildFly Application Server packaged as Bootable JAR.
Expand Down Expand Up @@ -62,9 +60,12 @@ public class StartJarMojo extends AbstractStartMojo {

/**
* When {@code bootable-jar} is set to true, use this parameter to name the generated jar file.
* The jar file is named by default {@code server-bootable.jar}.
* <p>
* Note that since 5.1 the default name changed from {@code server-bootable.jar} to
* {@code ${project.artifactId}-bootable.jar}.
* </p>
*/
@Parameter(alias = "bootable-jar-name", required = false, property = PropertyNames.BOOTABLE_JAR_NAME)
@Parameter(alias = "bootable-jar-name", property = PropertyNames.BOOTABLE_JAR_NAME, defaultValue = "${project.artifactId}-bootable.jar")
private String bootableJarName;

@Override
Expand Down Expand Up @@ -131,9 +132,7 @@ public String goal() {

@Override
protected Path getServerHome() throws MojoExecutionException, MojoFailureException {
String jarName = bootableJarName == null ? PackageServerMojo.BOOTABLE_JAR_NAME_RADICAL +
BootableJarSupport.BOOTABLE_SUFFIX + "." + PackageServerMojo.JAR
: bootableJarName;
String jarName = bootableJarName;
Path targetPath = Paths.get(project.getBuild().getDirectory());
Path jarFile = targetPath.toAbsolutePath()
.resolve(jarName);
Expand All @@ -142,4 +141,4 @@ protected Path getServerHome() throws MojoExecutionException, MojoFailureExcepti
}
return jarFile;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<record-provisioning-state>true</record-provisioning-state>
<provisioning-dir>packaged-bootable-glow-server</provisioning-dir>
<bootable-jar>true</bootable-jar>
<bootable-jar-name>server-bootable.jar</bootable-jar-name>
<discover-provisioning-info>
<addOns>
<addOn>openapi</addOn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<layer>jaxrs-server</layer>
</layers>
<filename>test.war</filename>
<bootable-jar-name>server-bootable.jar</bootable-jar-name>
<record-provisioning-state>true</record-provisioning-state>
<provisioning-dir>packaged-bootable-server</provisioning-dir>
<bootable-jar>true</bootable-jar>
Expand Down