Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
with
1 addition
and
20 deletions.
-
+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); |
|
|