Source:
<code>public void executeTask() throws MojoExecutionException, MojoFailureException { if (serverId == null) { File currentProperties = Server.checkCurrentDirForServer(); if (currentProperties != null) serverId = currentProperties.getName(); } serverId = wizard.promptForExistingServerIdIfMissing(serverId); Server server = loadValidatedServer(serverId); port = Integer.valueOf(server.getPort()); String message = "Set server port or use default from parameters"; <START> this.requestPortChnage(message, server); <END> serverHelper = new ServerHelper(wizard); this.validatePort(); wizard.showMessage(String.format("Using %s", port)); server.setParam("tomcat.port", String.valueOf(port)); server.save(); File serverPath = server.getServerDirectory(); serverPath.mkdirs(); File userDir = new File(System.getProperty("user.dir")); if (Project.hasProject(userDir)) { Project config = Project.loadProject(userDir); if (config.isOpenmrsModule()) { String artifactId = config.getArtifactId(); String groupId = config.getGroupId(); String version = config.getVersion(); if ((artifactId != null) && (groupId != null) && version != null) { getLog().info("OpenMRS module detected, installing before run..."); Deploy deployer = new Deploy(this); deployer.deployModule(serverPath.getName(), groupId, artifactId, version); } } } if (server.hasWatchedProjects()) { new Build(this, serverId).executeTask(); } if (Boolean.FALSE.equals(fork)) { new RunTomcat(serverId, port, mavenSession, mavenProject, pluginManager, wizard).execute(); } else { runInFork(server); } }</code><technical_language>running ask for a port, if server port is in use... please check if port is in first</technical_language>

Target:
public void executeTask() throws MojoExecutionException, MojoFailureException { if (serverId == null) { File currentProperties = Server.checkCurrentDirForServer(); if (currentProperties != null) serverId = currentProperties.getName(); } serverId = wizard.promptForExistingServerIdIfMissing(serverId); Server server = loadValidatedServer(serverId); port = (System.getProperty("port") != null ? Integer.valueOf(System.getProperty("port")) : Integer.valueOf(server.getPort())); serverHelper = new ServerHelper(wizard); this.validatePort(); wizard.showMessage(String.format("Using %s", port)); server.setParam("tomcat.port", String.valueOf(port)); server.save(); File serverPath = server.getServerDirectory(); serverPath.mkdirs(); File userDir = new File(System.getProperty("user.dir")); if (Project.hasProject(userDir)) { Project config = Project.loadProject(userDir); if (config.isOpenmrsModule()) { String artifactId = config.getArtifactId(); String groupId = config.getGroupId(); String version = config.getVersion(); if ((artifactId != null) && (groupId != null) && version != null) { getLog().info("OpenMRS module detected, installing before run..."); Deploy deployer = new Deploy(this); deployer.deployModule(serverPath.getName(), groupId, artifactId, version); } } } if (server.hasWatchedProjects()) { new Build(this, serverId).executeTask(); } if (Boolean.FALSE.equals(fork)) { new RunTomcat(serverId, port, mavenSession, mavenProject, pluginManager, wizard).execute(); } else { runInFork(server); } }