mirror of https://github.com/apache/maven.git
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:
parent
ee7973d53a
commit
230d50014a
|
@ -61,27 +61,38 @@ public class VersionTransformer
|
||||||
Element project = (Element) node;
|
Element project = (Element) node;
|
||||||
|
|
||||||
Node version = node.selectSingleNode( "version" );
|
Node version = node.selectSingleNode( "version" );
|
||||||
|
|
||||||
if ( version != null )
|
if ( version != null )
|
||||||
{
|
{
|
||||||
|
System.out.println( ">> We have a version element and we are changing it to " + getUpdatedModel().getVersion() );
|
||||||
|
|
||||||
version.setText( getUpdatedModel().getVersion() );
|
version.setText( getUpdatedModel().getVersion() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
System.out.println( ">> We are adding a version element and we are setting it to " + getUpdatedModel().getVersion() );
|
||||||
|
|
||||||
project.addElement( "version" ).addText( getUpdatedModel().getVersion() );
|
project.addElement( "version" ).addText( getUpdatedModel().getVersion() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( selectDependenciesNodesXPathExpression().equals( node.getPath() ) )
|
else if ( selectDependenciesNodesXPathExpression().equals( node.getPath() ) )
|
||||||
{
|
{
|
||||||
Element dependency = (Element) node;
|
Element dependency = (Element) node;
|
||||||
|
|
||||||
Node groupId = node.selectSingleNode( "groupId" );
|
Node groupId = node.selectSingleNode( "groupId" );
|
||||||
|
|
||||||
Node artifactId = node.selectSingleNode( "artifactId" );
|
Node artifactId = node.selectSingleNode( "artifactId" );
|
||||||
|
|
||||||
Node type = node.selectSingleNode( "type" );
|
Node type = node.selectSingleNode( "type" );
|
||||||
|
|
||||||
String typeText = "jar";
|
String typeText = "jar";
|
||||||
|
|
||||||
if ( type != null )
|
if ( type != null )
|
||||||
{
|
{
|
||||||
typeText = type.getText();
|
typeText = type.getText();
|
||||||
}
|
}
|
||||||
Node version = node.selectSingleNode( "version" );
|
Node version = node.selectSingleNode( "version" );
|
||||||
|
|
||||||
if ( version != null )
|
if ( version != null )
|
||||||
{
|
{
|
||||||
version.setText( getDependency( groupId.getText(), artifactId.getText(), typeText ).getVersion() );
|
version.setText( getDependency( groupId.getText(), artifactId.getText(), typeText ).getVersion() );
|
||||||
|
@ -95,15 +106,22 @@ public class VersionTransformer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Element plugin = (Element) node;
|
Element plugin = (Element) node;
|
||||||
|
|
||||||
Node groupId = node.selectSingleNode( "groupId" );
|
Node groupId = node.selectSingleNode( "groupId" );
|
||||||
|
|
||||||
String groupIdText = "org.apache.maven.plugins";
|
String groupIdText = "org.apache.maven.plugins";
|
||||||
|
|
||||||
if ( groupId != null )
|
if ( groupId != null )
|
||||||
{
|
{
|
||||||
groupIdText = groupId.getText();
|
groupIdText = groupId.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
Node artifactId = node.selectSingleNode( "artifactId" );
|
Node artifactId = node.selectSingleNode( "artifactId" );
|
||||||
|
|
||||||
Node version = node.selectSingleNode( "version" );
|
Node version = node.selectSingleNode( "version" );
|
||||||
|
|
||||||
Plugin p = getPlugin( groupIdText, artifactId.getText() );
|
Plugin p = getPlugin( groupIdText, artifactId.getText() );
|
||||||
|
|
||||||
if ( groupId != null )
|
if ( groupId != null )
|
||||||
{
|
{
|
||||||
groupId.setText( p.getGroupId() );
|
groupId.setText( p.getGroupId() );
|
||||||
|
@ -128,6 +146,7 @@ public class VersionTransformer
|
||||||
for ( Iterator i = getUpdatedModel().getDependencies().iterator(); i.hasNext(); )
|
for ( Iterator i = getUpdatedModel().getDependencies().iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
Dependency dependency = (Dependency) i.next();
|
Dependency dependency = (Dependency) i.next();
|
||||||
|
|
||||||
if ( dependency.getGroupId().equals( groupId ) && dependency.getArtifactId().equals( artifactId )
|
if ( dependency.getGroupId().equals( groupId ) && dependency.getArtifactId().equals( artifactId )
|
||||||
&& dependency.getType().equals( type ) )
|
&& dependency.getType().equals( type ) )
|
||||||
{
|
{
|
||||||
|
@ -143,6 +162,7 @@ public class VersionTransformer
|
||||||
for ( Iterator i = getUpdatedModel().getBuild().getPlugins().iterator(); i.hasNext(); )
|
for ( Iterator i = getUpdatedModel().getBuild().getPlugins().iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
Plugin plugin = (Plugin) i.next();
|
Plugin plugin = (Plugin) i.next();
|
||||||
|
|
||||||
if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
|
if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
|
||||||
{
|
{
|
||||||
return plugin;
|
return plugin;
|
||||||
|
|
Loading…
Reference in New Issue