|
100 | 100 | import org.apache.maven.shared.artifact.filter.resolve.PatternExclusionsFilter; |
101 | 101 | import org.apache.maven.shared.artifact.filter.resolve.PatternInclusionsFilter; |
102 | 102 | import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter; |
103 | | -import org.apache.maven.shared.invoker.MavenInvocationException; |
104 | 103 | import org.apache.maven.toolchain.Toolchain; |
105 | 104 | import org.apache.maven.toolchain.ToolchainManager; |
106 | 105 | import org.apache.maven.wagon.PathUtils; |
@@ -5364,53 +5363,57 @@ private List<OfflineLink> getModulesLinks() throws MavenReportException { |
5364 | 5363 |
|
5365 | 5364 | File location = new File(p.getBasedir(), javadocDirRelative); |
5366 | 5365 |
|
5367 | | - if (!location.exists()) { |
5368 | | - String javadocGoal = getFullJavadocGoal(); |
5369 | | - if (getLog().isDebugEnabled()) { |
5370 | | - getLog().debug("Javadoc directory not found: " + location); |
5371 | | - getLog().debug("The goal '" + javadocGoal + "' has not been previously called for the module: '" |
5372 | | - + p.getId() + "'. Trying to invoke it..."); |
5373 | | - } |
5374 | | - |
5375 | | - File invokerDir = new File(project.getBuild().getDirectory(), "invoker"); |
5376 | | - invokerDir.mkdirs(); |
5377 | | - File invokerLogFile = FileUtils.createTempFile("maven-javadoc-plugin", ".txt", invokerDir); |
5378 | | - try { |
5379 | | - JavadocUtil.invokeMaven( |
5380 | | - getLog(), |
5381 | | - session.getRepositorySession().getLocalRepository().getBasedir(), |
5382 | | - p.getFile(), |
5383 | | - Collections.singletonList(javadocGoal), |
5384 | | - null, |
5385 | | - invokerLogFile, |
5386 | | - session.getRequest().getGlobalSettingsFile(), |
5387 | | - session.getRequest().getUserSettingsFile(), |
5388 | | - session.getRequest().getGlobalToolchainsFile(), |
5389 | | - session.getRequest().getUserToolchainsFile()); |
5390 | | - } catch (MavenInvocationException e) { |
5391 | | - logError("MavenInvocationException: " + e.getMessage(), e); |
5392 | | - |
5393 | | - try { |
5394 | | - String invokerLogContent = |
5395 | | - new String(Files.readAllBytes(invokerLogFile.toPath()), StandardCharsets.UTF_8); |
5396 | | - // TODO: Why are we only interested in cases where the JVM won't start? |
5397 | | - // probably we should throw an error in all cases |
5398 | | - // [MJAVADOC-275][jdcasey] I changed the logic here to only throw an error WHEN |
5399 | | - // the JVM won't start (opposite of what it was). |
5400 | | - if (invokerLogContent.contains(JavadocUtil.ERROR_INIT_VM)) { |
5401 | | - throw new MavenReportException(e.getMessage(), e); |
5402 | | - } |
5403 | | - } catch (IOException ex) { |
5404 | | - // ignore |
5405 | | - } |
5406 | | - } finally { |
5407 | | - // just create the directory to prevent repeated invocations. |
5408 | | - if (!location.exists()) { |
5409 | | - getLog().warn("Creating fake javadoc directory to prevent repeated invocations: " + location); |
5410 | | - location.mkdirs(); |
5411 | | - } |
5412 | | - } |
5413 | | - } |
| 5366 | + // if (!location.exists()) { |
| 5367 | + // String javadocGoal = getFullJavadocGoal(); |
| 5368 | + // if (getLog().isDebugEnabled()) { |
| 5369 | + // getLog().debug("Javadoc directory not found: " + location); |
| 5370 | + // getLog().debug("The goal '" + javadocGoal + "' has not been previously called for the |
| 5371 | + // module: '" |
| 5372 | + // + p.getId() + "'. Trying to invoke it..."); |
| 5373 | + // } |
| 5374 | + // |
| 5375 | + // File invokerDir = new File(project.getBuild().getDirectory(), "invoker"); |
| 5376 | + // invokerDir.mkdirs(); |
| 5377 | + // File invokerLogFile = FileUtils.createTempFile("maven-javadoc-plugin", ".txt", |
| 5378 | + // invokerDir); |
| 5379 | + // try { |
| 5380 | + // JavadocUtil.invokeMaven( |
| 5381 | + // getLog(), |
| 5382 | + // session.getRepositorySession().getLocalRepository().getBasedir(), |
| 5383 | + // p.getFile(), |
| 5384 | + // Collections.singletonList(javadocGoal), |
| 5385 | + // null, |
| 5386 | + // invokerLogFile, |
| 5387 | + // session.getRequest().getGlobalSettingsFile(), |
| 5388 | + // session.getRequest().getUserSettingsFile(), |
| 5389 | + // session.getRequest().getGlobalToolchainsFile(), |
| 5390 | + // session.getRequest().getUserToolchainsFile()); |
| 5391 | + // } catch (MavenInvocationException e) { |
| 5392 | + // logError("MavenInvocationException: " + e.getMessage(), e); |
| 5393 | + // |
| 5394 | + // try { |
| 5395 | + // String invokerLogContent = |
| 5396 | + // new String(Files.readAllBytes(invokerLogFile.toPath()), |
| 5397 | + // StandardCharsets.UTF_8); |
| 5398 | + // // TODO: Why are we only interested in cases where the JVM won't start? |
| 5399 | + // // probably we should throw an error in all cases |
| 5400 | + // // [MJAVADOC-275][jdcasey] I changed the logic here to only throw an error WHEN |
| 5401 | + // // the JVM won't start (opposite of what it was). |
| 5402 | + // if (invokerLogContent.contains(JavadocUtil.ERROR_INIT_VM)) { |
| 5403 | + // throw new MavenReportException(e.getMessage(), e); |
| 5404 | + // } |
| 5405 | + // } catch (IOException ex) { |
| 5406 | + // // ignore |
| 5407 | + // } |
| 5408 | + // } finally { |
| 5409 | + // // just create the directory to prevent repeated invocations. |
| 5410 | + // if (!location.exists()) { |
| 5411 | + // getLog().warn("Creating fake javadoc directory to prevent repeated invocations: " |
| 5412 | + // + location); |
| 5413 | + // location.mkdirs(); |
| 5414 | + // } |
| 5415 | + // } |
| 5416 | + // } |
5414 | 5417 |
|
5415 | 5418 | if (location.exists()) { |
5416 | 5419 | String url = getJavadocLink(p); |
|
0 commit comments