o adding some more debug info to try and find the problem with a POM

transformation


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@171307 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2005-05-22 12:42:01 +00:00
parent ee7973d53a
commit 230d50014a
1 changed files with 20 additions and 0 deletions

View File

@ -61,27 +61,38 @@ public void transformNode( Node node )
Element project = (Element) node;
Node version = node.selectSingleNode( "version" );
if ( version != null )
{
System.out.println( ">> We have a version element and we are changing it to " + getUpdatedModel().getVersion() );
version.setText( getUpdatedModel().getVersion() );
}
else
{
System.out.println( ">> We are adding a version element and we are setting it to " + getUpdatedModel().getVersion() );
project.addElement( "version" ).addText( getUpdatedModel().getVersion() );
}
}
else if ( selectDependenciesNodesXPathExpression().equals( node.getPath() ) )
{
Element dependency = (Element) node;
Node groupId = node.selectSingleNode( "groupId" );
Node artifactId = node.selectSingleNode( "artifactId" );
Node type = node.selectSingleNode( "type" );
String typeText = "jar";
if ( type != null )
{
typeText = type.getText();
}
Node version = node.selectSingleNode( "version" );
if ( version != null )
{
version.setText( getDependency( groupId.getText(), artifactId.getText(), typeText ).getVersion() );
@ -95,15 +106,22 @@ else if ( selectDependenciesNodesXPathExpression().equals( node.getPath() ) )
else
{
Element plugin = (Element) node;
Node groupId = node.selectSingleNode( "groupId" );
String groupIdText = "org.apache.maven.plugins";
if ( groupId != null )
{
groupIdText = groupId.getText();
}
Node artifactId = node.selectSingleNode( "artifactId" );
Node version = node.selectSingleNode( "version" );
Plugin p = getPlugin( groupIdText, artifactId.getText() );
if ( groupId != null )
{
groupId.setText( p.getGroupId() );
@ -128,6 +146,7 @@ private Dependency getDependency( String groupId, String artifactId, String type
for ( Iterator i = getUpdatedModel().getDependencies().iterator(); i.hasNext(); )
{
Dependency dependency = (Dependency) i.next();
if ( dependency.getGroupId().equals( groupId ) && dependency.getArtifactId().equals( artifactId )
&& dependency.getType().equals( type ) )
{
@ -143,6 +162,7 @@ private Plugin getPlugin( String groupId, String artifactId )
for ( Iterator i = getUpdatedModel().getBuild().getPlugins().iterator(); i.hasNext(); )
{
Plugin plugin = (Plugin) i.next();
if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
{
return plugin;