private void fillMissingArtifactVersion ( final ArtifactItem item ) { log . trace ( "Attempting to find missing version in {}:{}" , item . getGroupId ( ) , item . getArtifactId ( ) ) ; List list = project . getDependencies ( ) ; for ( int i = 0 ; i < list . size ( ) ; ++ i ) { Dependency dependency = ( Dependency ) list . get ( i ) ; if ( dependency . getGroupId ( ) . equals ( item . getGroupId ( ) ) && dependency . getArtifactId ( ) . equals ( item . getArtifactId ( ) ) && dependency . getType ( ) . equals ( item . getType ( ) ) ) { log . trace ( "Found missing version: {} in dependency list" , dependency . getVersion ( ) ) ; item . setVersion ( dependency . getVersion ( ) ) ; return ; } } list = project . getDependencyManagement ( ) . getDependencies ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Dependency dependency = ( Dependency ) list . get ( i ) ; if ( dependency . getGroupId ( ) . equals ( item . getGroupId ( ) ) && dependency . getArtifactId ( ) . equals ( item . getArtifactId ( ) ) && dependency . getType ( ) . equals ( item . getType ( ) ) ) { log . trace ( "Found missing version: {} in dependency management list" , dependency . getVersion ( ) ) ; item . setVersion ( dependency . getVersion ( ) ) ; } } }
Tries to find missing version from dependency list and dependency management . If found the artifact is updated with the correct version .