protected boolean checkIfModelMatches ( String groupId , String artifactId , String version , Model model ) { // try these first. String modelGroup = model . getGroupId ( ) ; String modelArtifactId = model . getArtifactId ( ) ; String modelVersion = model . getVersion ( ) ; try { if ( StringUtils . isEmpty ( modelGroup ) ) { modelGroup = model . getParent ( ) . getGroupId ( ) ; } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.groupId} modelGroup = ( String ) helper . evaluate ( modelGroup ) ; } if ( StringUtils . isEmpty ( modelVersion ) ) { modelVersion = model . getParent ( ) . getVersion ( ) ; } else { // MENFORCER-30, handle cases where the value is a property like ${project.parent.version} modelVersion = ( String ) helper . evaluate ( modelVersion ) ; } // Is this only required for Maven2? modelArtifactId = ( String ) helper . evaluate ( modelArtifactId ) ; } catch ( NullPointerException e ) { // this is probably bad. I don't have a valid // group or version and I can't find a // parent???? // lets see if it's what we're looking for // anyway. } catch ( ExpressionEvaluationException e ) { // as above } return ( StringUtils . equals ( groupId , modelGroup ) && StringUtils . equals ( version , modelVersion ) && StringUtils . equals ( artifactId , modelArtifactId ) ) ; }
Make sure the model is the one I m expecting .