/** * Get attribute values and prompt if not selected * * @param helper * @param groupId * @param artifactId * @param version * @return */ public Artifact getArtifactForSelectedParameters( AttributeHelper helper, String groupId, String artifactId, String version) throws MojoExecutionException { File pomFile = new File(System.getProperty("user.dir"), SDKConstants.OPENMRS_MODULE_POM); String moduleGroupId = null; String moduleArtifactId = null; String moduleVersion = null; if (pomFile.exists() && (new ConfigurationManager(pomFile.getPath()).isOmod()) && (artifactId == null)) { ConfigurationManager manager = new ConfigurationManager(pomFile.getPath()); if (manager.getParent() != null) { moduleGroupId = manager.getParent().getGroupId(); moduleArtifactId = manager.getParent().getArtifactId(); moduleVersion = (version != null) ? version : manager.getParent().getVersion(); } else { moduleGroupId = manager.getGroupId(); moduleArtifactId = manager.getArtifactId(); moduleVersion = (version != null) ? version : manager.getVersion(); } } else { moduleGroupId = groupId; try { moduleArtifactId = helper.promptForValueIfMissing(artifactId, "artifactId"); moduleVersion = helper.promptForValueIfMissing(version, "version"); } catch (PrompterException e) { getLog().error(e.getMessage()); } } return new Artifact(moduleArtifactId, moduleVersion, moduleGroupId); }