o little dom4j tool to flip "id" to "artifactId" at the project level.
PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114522 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cf67b204bc
commit
e69e16aa43
46
Fix2.java
Normal file
46
Fix2.java
Normal file
@ -0,0 +1,46 @@
|
||||
import org.dom4j.*;
|
||||
import org.dom4j.io.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class Fix2
|
||||
{
|
||||
public static void main( String[] args )
|
||||
throws Exception
|
||||
{
|
||||
SAXReader r = new SAXReader();
|
||||
|
||||
Document d = r.read( new FileReader( args[0] ) );
|
||||
|
||||
Element root = d.getRootElement();
|
||||
|
||||
Element id = root.element( "id" );
|
||||
|
||||
if ( id != null )
|
||||
{
|
||||
System.out.println( id.getName() );
|
||||
|
||||
id.setName( "artifactId" );
|
||||
}
|
||||
|
||||
File f = new File( args[0] );
|
||||
|
||||
f.delete();
|
||||
|
||||
OutputStream os = new FileOutputStream( args[0] );
|
||||
|
||||
OutputFormat format = new OutputFormat();
|
||||
|
||||
format.setIndentSize( 2 );
|
||||
|
||||
format.setNewlines( true );
|
||||
|
||||
format.setTrimText( true );
|
||||
|
||||
XMLWriter writer = new XMLWriter( format );
|
||||
|
||||
writer.setOutputStream( os );
|
||||
|
||||
writer.write( d );
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user