diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java index 5bd3fb7a..ecd5d77b 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java @@ -780,10 +780,18 @@ protected static void invokeMaven( InvocationRequest request = new DefaultInvocationRequest(); request.setBaseDirectory(projectFile.getParentFile()); request.setPomFile(projectFile); - request.setGlobalSettingsFile(globalSettingsFile); - request.setUserSettingsFile(userSettingsFile); - request.setGlobalToolchainsFile(globalToolchainsFile); - request.setToolchainsFile(userToolchainsFile); + if (globalSettingsFile != null && globalSettingsFile.isFile()) { + request.setGlobalSettingsFile(globalSettingsFile); + } + if (userSettingsFile != null && userSettingsFile.isFile()) { + request.setUserSettingsFile(userSettingsFile); + } + if (globalToolchainsFile != null && globalToolchainsFile.isFile()) { + request.setGlobalToolchainsFile(globalToolchainsFile); + } + if (userToolchainsFile != null && userToolchainsFile.isFile()) { + request.setToolchainsFile(userToolchainsFile); + } request.setBatchMode(true); if (log != null) { request.setDebug(log.isDebugEnabled());