Skip to content
Permalink
Browse files

[JENKINS-8383] Maven 2.2 Project does not return a BuilderConfiguration,

only resolve parent artifact for Maven 3+

Originally-Committed-As: b82d07712e5003cebace29e5d25fdc61f1751390
  • Loading branch information...
Stephan Pauxberger
Stephan Pauxberger committed Sep 26, 2011
1 parent 02a08e0 commit 302289501379d0cdae7bc81977c9e035fe3e6b76
Showing with 1 addition and 20 deletions.
  1. +1 −20 src/main/java/hudson/maven/reporters/MavenFingerprinter.java
@@ -160,32 +160,13 @@ private void recordParents(MavenBuildProxy build, MavenProject pom) throws IOExc
}

private ArtifactRepository getLocalRepository(String mavenVersion, MavenProject parent) {
if (mavenVersion.startsWith("2.0")) return null;

if (mavenVersion.startsWith("2.")) {
return getMaven22LocalRepository(parent);
}
if (mavenVersion.startsWith("2.")) return null;

// Maven 3
return parent.getProjectBuildingRequest()
.getLocalRepository();
}


private ArtifactRepository getMaven22LocalRepository(MavenProject parent) {
ProjectBuilderConfiguration projectBuilderConfiguration;
try {
// Since maven-plugin is compiled against maven-core-3x, we need to retrieve
// this maven 2 object via reflection
Method method = MavenProject.class.getMethod("getProjectBuilderConfiguration");
projectBuilderConfiguration = (ProjectBuilderConfiguration) method.invoke(parent);
return projectBuilderConfiguration.getLocalRepository();
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Could not retrieve BuilderConfigration", e);
return null;
}
}

private void record(Collection<Artifact> artifacts, Map<String,String> record) throws IOException, InterruptedException {
for (Artifact a : artifacts)
record(a,record);

0 comments on commit 3022895

Please sign in to comment.
You can’t perform that action at this time.