|
25 | 25 | import java.net.URLClassLoader;
|
26 | 26 | import java.text.MessageFormat;
|
27 | 27 | import java.util.ArrayList;
|
28 |
| -import java.util.Collections; |
29 | 28 | import java.util.Iterator;
|
30 | 29 | import java.util.List;
|
31 | 30 | import java.util.Locale;
|
32 | 31 | import java.util.MissingResourceException;
|
33 | 32 | import java.util.ResourceBundle;
|
34 | 33 |
|
35 |
| -import org.apache.maven.model.ReportPlugin; |
36 |
| -import org.apache.maven.model.Reporting; |
37 | 34 | import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
|
38 | 35 | import org.apache.maven.plugins.annotations.Component;
|
39 | 36 | import org.apache.maven.plugins.annotations.Parameter;
|
40 | 37 | import org.apache.maven.project.MavenProject;
|
41 | 38 | import org.apache.maven.reporting.AbstractMavenReport;
|
42 | 39 | import org.apache.maven.settings.Settings;
|
43 |
| -import org.apache.maven.shared.utils.PathTool; |
44 | 40 | import org.codehaus.plexus.i18n.I18N;
|
45 | 41 | import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
|
46 | 42 | import org.codehaus.plexus.interpolation.InterpolationException;
|
@@ -154,7 +150,7 @@ public void executeReport(Locale locale) {
|
154 | 150 | locale,
|
155 | 151 | getConsoleLogger(),
|
156 | 152 | getReportsDirectories(),
|
157 |
| - constructXrefTestLocation(), |
| 153 | + linkXRef ? constructXrefLocation(xrefTestLocation, true) : null, |
158 | 154 | showSuccess);
|
159 | 155 | r.render();
|
160 | 156 | }
|
@@ -256,44 +252,6 @@ private List<MavenProject> getProjectsWithoutRoot() {
|
256 | 252 | return result;
|
257 | 253 | }
|
258 | 254 |
|
259 |
| - private String constructXrefTestLocation() { |
260 |
| - String location = null; |
261 |
| - if (linkXRef) { |
262 |
| - File xrefTestLocation = getXrefTestLocation(); |
263 |
| - |
264 |
| - String relativePath = PathTool.getRelativePath( |
265 |
| - getReportOutputDirectory().getAbsolutePath(), xrefTestLocation.getAbsolutePath()); |
266 |
| - if (relativePath == null || relativePath.isEmpty()) { |
267 |
| - relativePath = "."; |
268 |
| - } |
269 |
| - relativePath = relativePath + "/" + xrefTestLocation.getName(); |
270 |
| - if (xrefTestLocation.exists()) { |
271 |
| - // XRef was already generated by manual execution of a lifecycle binding |
272 |
| - location = relativePath; |
273 |
| - } else { |
274 |
| - // Not yet generated - check if the report is on its way |
275 |
| - Reporting reporting = project.getModel().getReporting(); |
276 |
| - List<ReportPlugin> reportPlugins = |
277 |
| - reporting != null ? reporting.getPlugins() : Collections.<ReportPlugin>emptyList(); |
278 |
| - for (ReportPlugin plugin : reportPlugins) { |
279 |
| - String artifactId = plugin.getArtifactId(); |
280 |
| - if ("maven-jxr-plugin".equals(artifactId)) { |
281 |
| - location = relativePath; |
282 |
| - } |
283 |
| - } |
284 |
| - } |
285 |
| - |
286 |
| - if (location == null) { |
287 |
| - getConsoleLogger().warning("Unable to locate Test Source XRef to link to - DISABLED"); |
288 |
| - } |
289 |
| - } |
290 |
| - return location; |
291 |
| - } |
292 |
| - |
293 |
| - private File getXrefTestLocation() { |
294 |
| - return xrefTestLocation != null ? xrefTestLocation : new File(getReportOutputDirectory(), "xref-test"); |
295 |
| - } |
296 |
| - |
297 | 255 | /**
|
298 | 256 | * @param locale The locale
|
299 | 257 | * @param key The key to search for
|
|
0 commit comments