1 package org.apache.maven.release;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import org.dom4j.Node;
21
22 /**
23 * This is a simple POM manipulator that doesn't take into account any sort of
24 * POM inheritance. When the interpolation and inheritance is cleaned up in the
25 * Maven we will be able to serialize a POM directly with greater ease. But we
26 * may stick with this Jaxen solution anyway because it's so easy. Just turn the
27 * POM in memory into a Dom4j document and perform the same operation as we are
28 * here.
29 */
30 public class DummySnapshotResolver
31 extends AbstractPomTransformer
32 {
33
34
35
36
37 public String selectNodesXPathExpression()
38 {
39 return "/project/dependencies/dependency[version='SNAPSHOT']";
40 }
41
42 public String selectNodeXPath()
43 {
44 return "version";
45 }
46
47 public String getNodeContent( Node node )
48 throws Exception
49 {
50 return "NON-SNAPSHOT";
51 }
52
53 public void transformNode( Node node )
54 throws Exception
55 {
56
57
58 Node version = node.selectSingleNode( selectNodeXPath() );
59 version.setText( getNodeContent( node ) );
60 }
61
62 public Node getTransformedNode( Node node )
63 throws Exception
64 {
65
66
67 Node version = node.selectSingleNode( selectNodeXPath() );
68 Node transformedNode = (Node) version.clone();
69 transformedNode.setText( getNodeContent( node ) );
70
71 return transformedNode;
72 }
73
74 }