Skip to content

Commit

Permalink
fix mojohaus#25 use raw model for dependencyManagement
Browse files Browse the repository at this point in the history
  • Loading branch information
tavin committed Feb 8, 2016
1 parent 98b5b20 commit 6017279
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.mojo.versions.api.ArtifactVersions;
import org.codehaus.mojo.versions.api.PomHelper;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;

import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

Expand Down Expand Up @@ -88,7 +90,8 @@ protected void update( ModifiedPomXMLEventReader pom )
{
if ( getProject().getDependencyManagement() != null && isProcessingDependencyManagement() )
{
useLatestVersions( pom, getProject().getDependencyManagement().getDependencies() );
Model rawModel = PomHelper.getRawModel( getProject() );
useLatestVersions( pom, rawModel.getDependencyManagement().getDependencies() );
}
if ( isProcessingDependencies() )
{
Expand All @@ -99,6 +102,9 @@ protected void update( ModifiedPomXMLEventReader pom )
{
throw new MojoExecutionException( e.getMessage(), e );
}
catch ( IOException e ) {
throw new MojoExecutionException( e.getMessage(), e );
}
}

private void useLatestVersions( ModifiedPomXMLEventReader pom, Collection dependencies )
Expand Down Expand Up @@ -139,4 +145,4 @@ private void useLatestVersions( ModifiedPomXMLEventReader pom, Collection depend
}
}

}
}

0 comments on commit 6017279

Please sign in to comment.