Commit 02f0c2b6 authored by Phillip Webb's avatar Phillip Webb

Get the version to clean from the pom.xml

parent aaebb3f3
...@@ -18,15 +18,34 @@ package org.springframework.boot.cli; ...@@ -18,15 +18,34 @@ package org.springframework.boot.cli;
import java.io.File; import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.springframework.boot.cli.command.CleanCommand; import org.springframework.boot.cli.command.CleanCommand;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/** /**
* @author Dave Syer * @author Dave Syer
*/ */
public class GrapesCleaner { public class GrapesCleaner {
// FIXME get the version private static final String VERSION;
private static final String VERSION = "0.5.0.BUILD-SNAPSHOT"; static {
try {
File pom = new File("pom.xml");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(pom);
Element parent = (Element) document.getDocumentElement()
.getElementsByTagName("parent").item(0);
VERSION = parent.getElementsByTagName("version").item(0).getFirstChild()
.getTextContent();
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
}
public static void cleanIfNecessary() throws Exception { public static void cleanIfNecessary() throws Exception {
File installedJar = new File(getMavenRepository(), String.format( File installedJar = new File(getMavenRepository(), String.format(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment