Skip to content

Commit 7e5dea4

Browse files
cpfeiffermichael-o
authored andcommitted
[MJAVADOC-798] Consider passing user settings when using invoker
This closes #290
1 parent 305f9cc commit 7e5dea4

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,8 @@ private void executeClirr() throws MavenInvocationException {
655655
Collections.singletonList(clirrGoal),
656656
properties,
657657
invokerLogFile,
658-
session.getRequest().getGlobalSettingsFile());
658+
session.getRequest().getGlobalSettingsFile(),
659+
session.getRequest().getUserSettingsFile());
659660

660661
try {
661662
if (invokerLogFile.exists()) {

src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5514,7 +5514,8 @@ private List<OfflineLink> getModulesLinks() throws MavenReportException {
55145514
Collections.singletonList(javadocGoal),
55155515
null,
55165516
invokerLogFile,
5517-
session.getRequest().getGlobalSettingsFile());
5517+
session.getRequest().getGlobalSettingsFile(),
5518+
session.getRequest().getUserSettingsFile());
55185519
} catch (MavenInvocationException e) {
55195520
logError("MavenInvocationException: " + e.getMessage(), e);
55205521

src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ protected static void copyResource(URL url, File file) throws IOException {
714714
* @param properties the properties for the goals, could be null.
715715
* @param invokerLog the log file where the invoker will be written, if null using <code>System.out</code>.
716716
* @param globalSettingsFile reference to settings file, could be null.
717+
* @param userSettingsFile reference to user settings file, could be null.
717718
* @throws MavenInvocationException if any
718719
* @since 2.6
719720
*/
@@ -724,7 +725,8 @@ protected static void invokeMaven(
724725
List<String> goals,
725726
Properties properties,
726727
File invokerLog,
727-
File globalSettingsFile)
728+
File globalSettingsFile,
729+
File userSettingsFile)
728730
throws MavenInvocationException {
729731
if (projectFile == null) {
730732
throw new IllegalArgumentException("projectFile should be not null.");
@@ -760,6 +762,7 @@ protected static void invokeMaven(
760762
request.setBaseDirectory(projectFile.getParentFile());
761763
request.setPomFile(projectFile);
762764
request.setGlobalSettingsFile(globalSettingsFile);
765+
request.setUserSettingsFile(userSettingsFile);
763766
request.setBatchMode(true);
764767
if (log != null) {
765768
request.setDebug(log.isDebugEnabled());

src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,14 @@ private void invokeCompileGoal(File testPom, Log log) throws Exception {
540540
Properties properties = new Properties();
541541

542542
JavadocUtil.invokeMaven(
543-
log, new File(getBasedir(), "target/local-repo"), testPom, goals, properties, invokerLogFile, null);
543+
log,
544+
new File(getBasedir(), "target/local-repo"),
545+
testPom,
546+
goals,
547+
properties,
548+
invokerLogFile,
549+
null,
550+
null);
544551
}
545552

546553
// ----------------------------------------------------------------------

0 commit comments

Comments
 (0)