88 ******************************************************************************/
99
1010/******************************************************************************
11- * Copyright (c) 2018-2022 Payara Foundation
11+ * Copyright (c) 2018-2023 Payara Foundation
1212 * All rights reserved. This program and the accompanying materials
1313 * are made available under the terms of the Eclipse Public License v2.0
1414 * which accompanies this distribution, and is available at
@@ -492,7 +492,8 @@ private void setDebugArgument(ILaunchConfigurationWorkingCopy config, String key
492492 * @return true if ant publisher needs to publish.
493493 */
494494 private boolean publishNeeded (int kind , int deltaKind , IModule [] module ) {
495- if ((getServer ().getServerPublishState () == PUBLISH_CLEAN ) || (kind != PUBLISH_INCREMENTAL && kind != PUBLISH_AUTO ) || (deltaKind != NO_CHANGE )) {
495+ if ((getServer ().getServerPublishState () == PUBLISH_CLEAN )
496+ || (kind != PUBLISH_INCREMENTAL && kind != PUBLISH_AUTO ) || (deltaKind != NO_CHANGE )) {
496497 return true ;
497498 }
498499
@@ -531,13 +532,13 @@ private void publishModuleForPayara(int kind, int deltaKind, IModule[] module, I
531532 Properties publishProperties = loadPublishProperties ();
532533
533534 boolean isRemote = getPayaraServerDelegate ().isRemote ();
535+ boolean isDockerInstance = getPayaraServerDelegate ().isDockerInstance ();
534536 boolean isJarDeploy = getPayaraServerDelegate ().getJarDeploy ();
535537
536- if ((!isRemote && !isJarDeploy )) {
538+ if ((!isRemote && !isJarDeploy ) || isDockerInstance ) {
537539 publishDeployedDirectory (kind , deltaKind , publishProperties , module , monitor );
538540 } else {
539541 publishJarFile (kind , deltaKind , publishProperties , module , monitor );
540-
541542 }
542543
543544 setModulePublishState (module , PUBLISH_STATE_NONE );
@@ -607,13 +608,17 @@ private void publishDeployedDirectory(int kind, int deltaKind, Properties publis
607608 return ;
608609 }
609610
610- IPath path = new Path (getPayaraServerDelegate ().getDomainPath () + "/eclipseApps/" + module [0 ].getName ());
611-
612611 // Using PublishHelper to control the temp area to be in the same file system of
613612 // the deployed apps
614613 // so that the move operation Eclipse is doing sometimes can work.
615- PublishHelper helper = new PublishHelper (
616- new Path (getPayaraServerDelegate ().getDomainPath () + "/eclipseAppsTmp" ).toFile ());
614+ boolean dockerInstance = getPayaraServerDelegate ().isDockerInstance ();
615+ String hostPath = getPayaraServerDelegate ().getHostPath ();
616+ String containerPath = getPayaraServerDelegate ().getContainerPath ();
617+
618+ String parentPath = dockerInstance ? getPayaraServerDelegate ().getHostPath ()
619+ : getPayaraServerDelegate ().getDomainPath ();
620+ IPath path = new Path (parentPath + "/eclipseApps/" + module [0 ].getName ());
621+ PublishHelper helper = new PublishHelper (new Path (parentPath + "/eclipseAppsTmp" ).toFile ());
617622
618623 AssembleModules assembler = new AssembleModules (module , path , getPayaraServerDelegate (), helper );
619624 logMessage ("Deploy direcotry " + path .toFile ().getAbsolutePath ());
@@ -675,7 +680,7 @@ private void publishDeployedDirectory(int kind, int deltaKind, Properties publis
675680 CommandTarget command = null ;
676681 if (deltaKind == ADDED ) {
677682 command = new CommandDeploy (name , null , new File ("" + path ), contextRoot , properties , new File [0 ],
678- hotDeploy );
683+ dockerInstance , hostPath , containerPath , hotDeploy );
679684 } else {
680685 command = new CommandRedeploy (name , null , contextRoot , properties , new File [0 ], keepSession ,
681686 hotDeploy , metadataChanged , sourcesChanged );
@@ -718,6 +723,10 @@ private void publishJarFile(int kind, int deltaKind, Properties p, IModule[] mod
718723 String name = simplifyModuleID (module [0 ].getName ());
719724 String contextRoot = null ;
720725
726+ boolean dockerInstance = getPayaraServerDelegate ().isDockerInstance ();
727+ String hostPath = getPayaraServerDelegate ().getHostPath ();
728+ String containerPath = getPayaraServerDelegate ().getContainerPath ();
729+
721730 if (isModuleType (module [0 ], "jst.web" )) {
722731 contextRoot = getContextRoot (module );
723732 }
@@ -727,9 +736,9 @@ private void publishJarFile(int kind, int deltaKind, Properties p, IModule[] mod
727736 boolean hotDeploy = getServer ().getAttribute (PayaraServer .ATTR_HOTDEPLOY ,
728737 Boolean .parseBoolean (DEFAULT_HOT_DEPLOY ));
729738 try {
730- ServerAdmin
731- .executeOn ( getPayaraServerDelegate ()). command (new CommandDeploy (name , null , archivePath ,
732- contextRoot , getDeploymentProperties (), new File [0 ], hotDeploy ))
739+ ServerAdmin . executeOn ( getPayaraServerDelegate ())
740+ .command (new CommandDeploy (name , null , archivePath , contextRoot , getDeploymentProperties () ,
741+ new File [0 ], dockerInstance , hostPath , containerPath , hotDeploy ))
733742 .timeout (520 ).onNotCompleted (result -> {
734743 logMessage ("deploy is failing=" + result .getValue ());
735744 throw new IllegalStateException ("deploy is failing=" + result .getValue ());
0 commit comments