@Override public final T build() { checkState(deployable.getType() == DeployableType.WAR || deployable.getType() == DeployableType.DIR, "Can only deploy directories or WARs"); String sourcePath = deployable.getPath().getAbsolutePath(); LOG.debug("Deploying: [{}]: [{}]", deployable.getType(), sourcePath); getSpecBuilder().property("context", deployContext); getSpecBuilder().port(PortMappingSpec.random(defaultPort())).waitFor(PortListeningWait.portListening(defaultPort())) .waitFor(LogCheckWait.logMessage(getStartupLogText())).waitFor(ContextPathStatusWait.contextStatus(getDeployContext(), defaultPort(), 200)); copy(sourcePath, getContainerAppPath(), deployFileName + ".war"); if (!servletVariables.isEmpty()) { env(javaOpts(), new ServletVariableProvider(servletVariables)); } return buildInstance(getSpecBuilder()); }