public IPath publishModuleFull(IProgressMonitor monitor) throws CoreException { final IPath deployPath = LiferayServerCore.getTempLocation("direct-deploy", StringPool.EMPTY); // $NON-NLS-1$ File warFile = deployPath.append(getProject().getName() + ".war").toFile(); // $NON-NLS-1$ warFile.getParentFile().mkdirs(); final Map<String, String> properties = new HashMap<String, String>(); properties.put(ISDKConstants.PROPERTY_AUTO_DEPLOY_UNPACK_WAR, "false"); // $NON-NLS-1$ final ILiferayRuntime runtime = ServerUtil.getLiferayRuntime(getProject()); final String appServerDeployDirProp = ServerUtil.getAppServerPropertyKey(ISDKConstants.PROPERTY_APP_SERVER_DEPLOY_DIR, runtime); properties.put(appServerDeployDirProp, deployPath.toOSString()); // IDE-1073 LPS-37923 properties.put(ISDKConstants.PROPERTY_PLUGIN_FILE_DEFAULT, warFile.getAbsolutePath()); properties.put(ISDKConstants.PROPERTY_PLUGIN_FILE, warFile.getAbsolutePath()); final String fileTimeStamp = System.currentTimeMillis() + ""; // IDE-1491 properties.put(ISDKConstants.PROPERTY_LP_VERSION, fileTimeStamp); properties.put(ISDKConstants.PROPERTY_LP_VERSION_SUFFIX, ".0"); final Map<String, String> appServerProperties = ServerUtil.configureAppServerProperties(getProject()); final IStatus directDeployStatus = sdk.war( getProject(), properties, true, appServerProperties, new String[] {"-Duser.timezone=GMT"}, monitor); if (!directDeployStatus.isOK() || (!warFile.exists())) { String pluginVersion = "1"; final IPath pluginPropertiesPath = new Path("WEB-INF/liferay-plugin-package.properties"); final IFile propertiesFile = CoreUtil.getDocrootFile(getProject(), pluginPropertiesPath.toOSString()); if (propertiesFile != null) { try { if (propertiesFile.exists()) { final PropertiesConfiguration pluginPackageProperties = new PropertiesConfiguration(); final InputStream is = propertiesFile.getContents(); pluginPackageProperties.load(is); pluginVersion = pluginPackageProperties.getString("module-incremental-version"); is.close(); } } catch (Exception e) { LiferayCore.logError("error reading module-incremtnal-version. ", e); } } warFile = sdk.getLocation() .append("dist") .append( getProject().getName() + "-" + fileTimeStamp + "." + pluginVersion + ".0" + ".war") .toFile(); if (!warFile.exists()) { throw new CoreException(directDeployStatus); } } return new Path(warFile.getAbsolutePath()); }
@Override protected IStatus run(IProgressMonitor monitor) { IStatus retval = Status.OK_STATUS; if (monitor != null) { monitor.beginTask(Msgs.runningCleanAppServerTask, IProgressMonitor.UNKNOWN); } try { IRuntime runtime = ServerUtil.getRuntime(project); IServer[] servers = ServerUtil.getServersForRuntime(runtime); for (IServer server : servers) { String mode = server.getServerState() == IServer.STATE_STARTED ? server.getMode() : null; if (mode != null) { LiferayTomcatUtil.syncStopServer(server); } } ILiferayTomcatRuntime portalTomcatRuntime = LiferayTomcatUtil.getLiferayTomcatRuntime(runtime); IPath bundleZipLocation = portalTomcatRuntime.getBundleZipLocation(); Map<String, String> appServerProperties = ServerUtil.configureAppServerProperties(project); String appServerDir = ServerUtil.getAppServerPropertyKey( ISDKConstants.PROPERTY_APP_SERVER_DIR, portalTomcatRuntime); IStatus status = getSDK() .cleanAppServer( project, bundleZipLocation, appServerDir, appServerProperties, monitor); assertStatus(status); for (IServer server : servers) { // need to mark all other server modules at needing republishing since ext will wipe out // webapps folder IModule[] modules = server.getModules(); for (IModule mod : modules) { IModule[] m = new IModule[] {mod}; ((LiferayTomcatServerBehavior) server.loadAdapter(LiferayTomcatServerBehavior.class, monitor)) .setModulePublishState2(m, IServer.PUBLISH_STATE_FULL); } } } catch (Exception ex) { retval = LiferayTomcatPlugin.createErrorStatus(ex); } if (monitor != null) { monitor.done(); } return retval; }