Skip to content
Open
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 @@ -47,6 +47,13 @@ public interface Constants {

String VERSION = "version";
String HOT_DEPLOY = "hotDeploy";
String DEV_MODE = "devMode";
String DEPLOY_WAR = "deployWar";
String EXPLODED = "exploded";
String TRIM_LOG = "trimLog";
String AUTO_DEPLOY = "autoDeploy";
String KEEP_STATE = "keepState";
String LIVE_RELOAD = "liveReload";

String WAR_PACKAGING = "war";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.3.0</version>
<version>2.5.1</version>
<configuration>
<payaraVersion>${r"${version.payara}"}</payaraVersion>
<deployWar>false</deployWar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,17 @@ ERR_Compile_On_Save_Not_Enabled=Reload Error ({0} : Compile on save not enabled)
ERR_Payara_Micro_Plugin_Not_Found=Reload Error ({0} : Payara Micro plugin not found)
MicroPropertiesPanel.hotDeployLabel.text=Hot Deploy:
MicroPropertiesPanel.hotDeployCheckBox.text=
MicroPropertiesPanel.devModeLabel.text=Dev Mode:
MicroPropertiesPanel.devModeCheckBox.text=
MicroPropertiesPanel.trimLogLabel.text=Trim Log:
MicroPropertiesPanel.trimLogCheckBox.text=
MicroPropertiesPanel.keepStateLabel.text=Keep State:
MicroPropertiesPanel.keepStateCheckBox.text=
MicroPropertiesPanel.liveReloadLabel.text=Live Reload:
MicroPropertiesPanel.liveReloadCheckBox.text=
MicroPropertiesPanel.autoDeployLabel.text=Auto Deploy:
MicroPropertiesPanel.autoDeployCheckBox.text=
MicroPropertiesPanel.explodedLabel.text=Exploded:
MicroPropertiesPanel.explodedCheckBox.text=
MicroPropertiesPanel.deployWarLabel.text=Deploy War:
MicroPropertiesPanel.deployWarCheckBox.text=
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@
import org.netbeans.api.annotations.common.StaticResource;
import org.netbeans.api.project.Project;
import static org.netbeans.api.project.ProjectUtils.getPreferences;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.AUTO_DEPLOY;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.DEPLOY_WAR;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.EXPLODED;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.HOT_DEPLOY;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.KEEP_STATE;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.LIVE_RELOAD;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.TRIM_LOG;
import static org.netbeans.modules.fish.payara.micro.plugin.Constants.VERSION;
import org.netbeans.modules.maven.api.NbMavenProject;
import org.netbeans.modules.maven.api.execute.RunConfig;
Expand Down Expand Up @@ -93,13 +99,77 @@ public RunConfig createConfigForDefaultAction(String actionName, Project project
Preferences pref = getPreferences(project, MicroApplication.class, true);
String microVersionText = pref.get(VERSION, "");
Boolean hotDeploy = pref.getBoolean(HOT_DEPLOY, false);
Boolean deployWar = pref.getBoolean(DEPLOY_WAR, true);
Boolean exploded = pref.getBoolean(EXPLODED, true);
Boolean trimLog = pref.getBoolean(TRIM_LOG, true);
Boolean autoDeploy = pref.getBoolean(AUTO_DEPLOY, true);
Boolean keepState = pref.getBoolean(KEEP_STATE, true);
Boolean liveReload = pref.getBoolean(LIVE_RELOAD, true);
RunConfig config = actionsProvider.createConfigForDefaultAction(actionName, project, lookup);
if (!microVersionText.isEmpty()) {
config.setProperty("version.payara", microVersionText);
}
if(hotDeploy) {
config.setProperty("hotDeploy", Boolean.TRUE.toString());
if (MicroApplication.isDevModeAvailable(project)
&& MicroApplication.isPluginVersionAtLeast(project, 2.5)) {
// In payara-micro-maven-plugin:2.5 system properties prefixed with payara
if (!microVersionText.isEmpty()) {
config.setProperty("payara.micro.version", microVersionText);
}
if (hotDeploy) {
config.setProperty("payara.hot.deploy", Boolean.TRUE.toString());
}
if (deployWar) {
config.setProperty("payara.deploy.war", Boolean.TRUE.toString());
}
if (exploded) {
config.setProperty("payara.exploded", Boolean.TRUE.toString());
}
if (trimLog) {
config.setProperty("payara.trim.log", Boolean.TRUE.toString());
}
if (autoDeploy) {
config.setProperty("payara.auto.deploy", Boolean.TRUE.toString());
}
if (keepState) {
config.setProperty("payara.keep.state", Boolean.TRUE.toString());
}
if (liveReload) {
config.setProperty("payara.live.reload", Boolean.TRUE.toString());
}
} else if (MicroApplication.isDevModeAvailable(project)
&& MicroApplication.isPluginVersionAtLeast(project, 2.1)) {
// In payara-micro-maven-plugin:2.1 dev mode feature added
if (!microVersionText.isEmpty()) {
config.setProperty("payaraVersion", microVersionText);
}
if (hotDeploy) {
config.setProperty("hotDeploy", Boolean.TRUE.toString());
}
if (deployWar) {
config.setProperty("deployWar", Boolean.TRUE.toString());
}
if (exploded) {
config.setProperty("exploded", Boolean.TRUE.toString());
}
if (trimLog) {
config.setProperty("trimLog", Boolean.TRUE.toString());
}
if (autoDeploy) {
config.setProperty("autoDeploy", Boolean.TRUE.toString());
}
if (keepState) {
config.setProperty("keepState", Boolean.TRUE.toString());
}
if (liveReload) {
config.setProperty("liveReload", Boolean.TRUE.toString());
}
} else {
// to ensure compatibility with older plugin
if (!microVersionText.isEmpty()) {
config.setProperty("payaraVersion", microVersionText);
}
if (hotDeploy) {
config.setProperty("hotDeploy", Boolean.TRUE.toString());
}
}

return config;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,14 @@ public static boolean isDevModeAvailable(Project project) {
String versionString = getPayaraMicroProject(project).getVersion();
if (versionString != null) {
try {
double version = Double.parseDouble(versionString);
if (version > 2.1) {
return true;
String[] parts = versionString.split("\\.");
if (parts.length >= 2) {
double version = Double.parseDouble(parts[0] + "." + parts[1]);
if (version >= 2.1) {
return true;
}
}

} catch (NumberFormatException e) {
if ("RELEASE".equals(versionString)) {
return true;
Expand All @@ -197,5 +201,26 @@ public static boolean isDevModeAvailable(Project project) {
}
return false;
}

public static boolean isPluginVersionAtLeast(Project project, double minVersion) {
if (isPayaraMicroProject(project)) {
String versionString = getPayaraMicroProject(project).getVersion();
if (versionString != null) {
try {
String[] parts = versionString.split("\\.");
if (parts.length >= 2) {
double version = Double.parseDouble(parts[0] + "." + parts[1]);
return version >= minVersion;
}
} catch (NumberFormatException e) {
// For snapshot or release tags like "RELEASE", "SNAPSHOT", etc.
if ("RELEASE".equalsIgnoreCase(versionString)) {
return true;
}
}
}
}
return false;
}

}
Loading
Loading