private ArtifactRepository getLocalRepository(MavenBuildInformation mavenBuildInformation, MavenProject pom) { if (mavenBuildInformation.isMaven3OrLater()) { return pom.getProjectBuildingRequest().getLocalRepository(); } else if (mavenBuildInformation.isAtLeastMavenVersion("2.2")) { // principally this should also work with Maven 2.1, but it's not tested, so err on the safe side return getArtifactRepositoryMaven21(pom); } else if (mavenBuildInformation.isAtLeastMavenVersion("2.0")) { // Maven 2.0 has no corresponding mechanism return null; } else { LOGGER.warning("Unknown Maven version: "+mavenBuildInformation.getMavenVersion()); return null; } }
public boolean preExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener) throws InterruptedException, IOException { if (isTestMojo(mojo)) { // tell test mojo to keep going even if there was a failure, // so that we can record this as yellow. // note that because of the way Maven works, just updating system property at this point is too late // Many test plugins have - as surefire - a configuration key 'testFailureIgnore' which defaults to // ${maven.test.failure.ignore}, so just try that one and change value to true, // if it's still at that default: XmlPlexusConfiguration c = (XmlPlexusConfiguration) mojo.configuration.getChild("testFailureIgnore",false); if(c!=null && c.getValue() != null && c.getValue().equals("${maven.test.failure.ignore}") && System.getProperty("maven.test.failure.ignore")==null) { if (build.getMavenBuildInformation().isMaven3OrLater()) { String fieldName = "testFailureIgnore"; if (mojo.mojoExecution.getConfiguration().getChild( fieldName ) != null) { mojo.mojoExecution.getConfiguration().getChild( fieldName ).setValue( Boolean.TRUE.toString() ); } else { Xpp3Dom child = new Xpp3Dom( fieldName ); child.setValue( Boolean.TRUE.toString() ); mojo.mojoExecution.getConfiguration().addChild( child ); } } else { c.setValue(Boolean.TRUE.toString()); } } } return true; }
boolean maven3orLater = mavenBuildInformation.isMaven3OrLater();
if (mavenBuildInformation.isMaven3OrLater())