diff --git a/maven-plugin/src/main/java/org/openmrs/maven/plugins/BuildDistro.java b/maven-plugin/src/main/java/org/openmrs/maven/plugins/BuildDistro.java index eca09fb0..6df9fbb0 100644 --- a/maven-plugin/src/main/java/org/openmrs/maven/plugins/BuildDistro.java +++ b/maven-plugin/src/main/java/org/openmrs/maven/plugins/BuildDistro.java @@ -147,8 +147,7 @@ else if (Project.hasProject(userDir)) { } } else if (StringUtils.isNotBlank(distro)) { - Artifact distroArtifact = DistroHelper.parseDistroArtifact(distro, versionsHelper); - distribution = builder.buildFromArtifact(distroArtifact); + distribution = distroHelper.resolveDistributionForStringSpecifier(distro, versionsHelper); } if (distribution == null) { diff --git a/sdk-commons/src/main/java/org/openmrs/maven/plugins/utility/DistroHelper.java b/sdk-commons/src/main/java/org/openmrs/maven/plugins/utility/DistroHelper.java index d90234bb..2536b166 100644 --- a/sdk-commons/src/main/java/org/openmrs/maven/plugins/utility/DistroHelper.java +++ b/sdk-commons/src/main/java/org/openmrs/maven/plugins/utility/DistroHelper.java @@ -90,9 +90,6 @@ public DistroProperties createDistroForPlatform(Server server) { /** * Saves all custom properties from distroProperties starting with "property." to server - * - * @param properties - * @param server */ public void savePropertiesToServer(DistroProperties properties, Server server) throws MojoExecutionException { if (properties != null) { @@ -245,7 +242,6 @@ public File extractFileFromDistro(File path, Artifact artifact, String filename) FileUtils.copyInputStreamToFile(zipFile.getInputStream(zipEntry), resultFile); } } - zipFile.close(); } catch (IOException e) { throw new MojoExecutionException("Could not read \"" + distroFile.getAbsolutePath() + "\" to temp folder " + e.getMessage(), e); @@ -257,37 +253,9 @@ public File extractFileFromDistro(File path, Artifact artifact, String filename) return resultFile; } - public DistroProperties downloadDistroProperties(File path, Artifact artifact) throws MojoExecutionException { - File file = downloadDistro(path, artifact); - DistroProperties distroProperties = null; - try (ZipFile zipFile = new ZipFile(file)) { - Enumeration entries = zipFile.entries(); - - while (entries.hasMoreElements()) { - ZipEntry zipEntry = entries.nextElement(); - if ("openmrs-distro.properties".equals(zipEntry.getName()) || "distro.properties".equals(zipEntry.getName())) { - Properties properties = new Properties(); - properties.load(zipFile.getInputStream(zipEntry)); - distroProperties = new DistroProperties(properties); - } - } - } - catch (IOException e) { - throw new MojoExecutionException("Could not read \"" + file.getAbsolutePath() + "\" " + e.getMessage(), e); - } - finally { - file.delete(); - } - - return distroProperties; - } - /** * Distro can be passed in two ways: either as maven artifact identifier or path to distro file * Returns null if string is invalid as path or identifier - * - * @param distro - * @return */ public Distribution resolveDistributionForStringSpecifier(String distro, VersionsHelper versionsHelper) throws MojoExecutionException { DistributionBuilder builder = new DistributionBuilder(mavenEnvironment); @@ -310,9 +278,6 @@ public Distribution resolveDistributionForStringSpecifier(String distro, Version /** * Distro can be passed in two ways: either as maven artifact identifier or path to distro file * Returns null if string is invalid as path or identifier - * - * @param distro - * @return */ public DistroProperties resolveDistroPropertiesForStringSpecifier(String distro, VersionsHelper versionsHelper) throws MojoExecutionException { Distribution distribution = resolveDistributionForStringSpecifier(distro, versionsHelper);