58
58
import org .codehaus .mojo .versions .api .VersionRetrievalException ;
59
59
import org .codehaus .mojo .versions .api .VersionsHelper ;
60
60
import org .codehaus .mojo .versions .api .recording .ChangeRecorder ;
61
- import org .codehaus .mojo .versions .rewriting .ModifiedPomXMLEventReader ;
61
+ import org .codehaus .mojo .versions .rewriting .MutableXMLStreamReader ;
62
62
import org .eclipse .aether .RepositorySystem ;
63
63
import static org .twdata .maven .mojoexecutor .MojoExecutor .*;
64
64
@@ -120,7 +120,7 @@ public class IncrementalifyMojo extends AbstractVersionsUpdaterMojo {
120
120
}
121
121
}
122
122
123
- @ Override protected void update (ModifiedPomXMLEventReader pom ) throws MojoExecutionException , MojoFailureException , XMLStreamException {
123
+ @ Override protected void update (MutableXMLStreamReader pom ) throws MojoExecutionException , MojoFailureException , XMLStreamException {
124
124
String version = PomHelper .getProjectVersion (pom );
125
125
Matcher m = Pattern .compile ("(.+)-SNAPSHOT" ).matcher (version );
126
126
if (!m .matches ()) {
@@ -175,7 +175,7 @@ public class IncrementalifyMojo extends AbstractVersionsUpdaterMojo {
175
175
* @return The parent artifact or <code>null</code> if no parent is specified.
176
176
* @throws XMLStreamException if something went wrong.
177
177
*/
178
- private static Artifact getProjectParent ( final ModifiedPomXMLEventReader pom , VersionsHelper helper )
178
+ private static Artifact getProjectParent ( final MutableXMLStreamReader pom , VersionsHelper helper )
179
179
throws XMLStreamException
180
180
{
181
181
Stack <String > stack = new Stack <>();
@@ -189,11 +189,11 @@ private static Artifact getProjectParent( final ModifiedPomXMLEventReader pom, V
189
189
190
190
while ( pom .hasNext () )
191
191
{
192
- XMLEvent event = pom .nextEvent ();
193
- if ( event .isStartElement () )
192
+ pom .next ();
193
+ if ( pom .isStartElement () )
194
194
{
195
195
stack .push ( path );
196
- final String elementName = event . asStartElement (). getName (). getLocalPart ();
196
+ final String elementName = pom . getLocalName ();
197
197
path = path + "/" + elementName ;
198
198
199
199
if ( matchScopeRegex .matcher ( path ).matches () )
@@ -215,7 +215,7 @@ else if ( "version".equals( elementName ) )
215
215
}
216
216
}
217
217
}
218
- if ( event .isEndElement () )
218
+ if ( pom .isEndElement () )
219
219
{
220
220
path = stack .pop ();
221
221
}
@@ -245,18 +245,18 @@ static ReplaceGitHubRepo replaceGitHubRepo(String text) throws MojoFailureExcept
245
245
return new ReplaceGitHubRepo (m .group (1 ) + "${gitHubRepo}" + m .group (3 ), m .group (2 ));
246
246
}
247
247
248
- private void prependProperty (ModifiedPomXMLEventReader pom , String name , String value ) throws XMLStreamException , MojoFailureException {
248
+ private void prependProperty (MutableXMLStreamReader pom , String name , String value ) throws XMLStreamException , MojoFailureException {
249
249
Stack <String > stack = new Stack <>();
250
250
pom .rewind ();
251
251
boolean found = false ;
252
252
while (pom .hasNext ()) {
253
- XMLEvent event = pom .nextEvent ();
254
- if (event .isStartElement ()) {
255
- stack .push (event . asStartElement (). getName (). getLocalPart ());
253
+ pom .next ();
254
+ if (pom .isStartElement ()) {
255
+ stack .push (pom . getLocalName ());
256
256
if (stack .equals (Arrays .asList ("project" , "properties" ))) {
257
257
pom .mark (0 );
258
258
}
259
- } else if (event .isEndElement ()) {
259
+ } else if (pom .isEndElement ()) {
260
260
if (stack .equals (Arrays .asList ("project" , "properties" ))) {
261
261
pom .mark (1 );
262
262
found = true ;
0 commit comments