1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package au.com.acegi.xmlformat;
19
20 import static au.com.acegi.xmlformat.FormatUtil.formatInPlace;
21 import static org.apache.maven.plugins.annotations.LifecyclePhase.PREPARE_PACKAGE;
22
23 import java.io.File;
24 import java.io.IOException;
25
26 import org.apache.maven.plugins.annotations.Mojo;
27 import org.dom4j.DocumentException;
28
29
30
31
32 @Mojo(name = "xml-format", defaultPhase = PREPARE_PACKAGE, threadSafe = true)
33 public final class XmlFormatPlugin extends AbstractXmlPlugin {
34
35 @Override
36 protected boolean processFile(final File input, final XmlOutputFormat fmt) throws DocumentException, IOException {
37 final boolean changed = formatInPlace(input, fmt);
38 if (getLog().isDebugEnabled()) {
39 final String msg = changed ? "Formatted" : "Unchanged";
40 getLog().debug("[xml-format] " + msg + ": " + input);
41 }
42 return changed;
43 }
44
45 @Override
46 protected void afterAllProcessed(final boolean neededFormatting) {
47
48 }
49 }