Skip to content

Commit

Permalink
Merge pull request #579 from jamezp/WFMP-265
Browse files Browse the repository at this point in the history
[WFMP-265] Default the bootable JAR name to be the artifact ID + "-bo…
  • Loading branch information
jamezp authored Oct 8, 2024
2 parents fa33d98 + 4f6787a commit b944171
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
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
15 changes: 7 additions & 8 deletions plugin/src/main/java/org/wildfly/plugin/server/StartJarMojo.java
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

0 comments on commit b944171

Please sign in to comment.