maven-javadoc-plugin error javadoc: error - cannot read Input length = 1 with non-ASCII characters in...





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







5















I'm using OpenJDK 11 on Windows 10. I have a very simple POM, for a single Java file, that generates Javadocs. Here is an extract:



<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


Strangely just running mvn clean package causes an error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (default) on project foobar: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - cannot read Input length = 1
[ERROR]
[ERROR] Command line was: C:binjdk-11binjavadoc.exe @options @packages


In target/apidocs there are only three files: javadoc.bat, options, and packages. The options file is the most interesting. It explicitly says UTF-8 everywhere, as it should. But look at these lines:



-sourcepath
C:/projects/li��o 1/src/main/java


This project is in C:projectslição 1. It appears that somewhere along the chain Java or Maven or the Javadoc plugin didn't correctly convert the directory name to UTF-8.



Sure enough; when I renamed the directories in Windows to remove non-ASCII characters, mvn clean package worked just fine.



This would seem like a blatant bug; once Maven starts, everything should be UTF-8 throughout. Is it a problem with the Javadoc plugin? Anyone have an idea where this originates? Where should I file a bug ticket? Or am I doing something wrong?










share|improve this question























  • First you have defined the source encoding ...the question is which encoding is given to the JVM which is used by Maven? issues.apache.org/jira/projects/MJAVADOC ?

    – khmarbaise
    Nov 23 '18 at 15:14











  • Have you tried to add <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> to <properties> block?

    – Mikhail Kholodkov
    Nov 27 '18 at 17:17











  • Can you provide me some reference to what this is supposed to do, or is this a guess of something you haven't tried?

    – Garret Wilson
    Nov 27 '18 at 22:11











  • Note that maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html is clear that encoding defaults to project.build.sourceEncoding. But we're talking about the interpretation of directory names. I think this is a bug.

    – Garret Wilson
    Nov 27 '18 at 22:13











  • Mikhail, docencoding (which is the configuration that uses the project.reporting.outputEncoding you referred to) specifies to the output encoding. How would this have anything to do with the encoding of the directory names the plugin places in the options file? Have you actually reproduced this on your machine? Have you actually seen this options file I'm talking about? Do you understand the problem?

    – Garret Wilson
    Nov 27 '18 at 22:15


















5















I'm using OpenJDK 11 on Windows 10. I have a very simple POM, for a single Java file, that generates Javadocs. Here is an extract:



<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


Strangely just running mvn clean package causes an error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (default) on project foobar: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - cannot read Input length = 1
[ERROR]
[ERROR] Command line was: C:binjdk-11binjavadoc.exe @options @packages


In target/apidocs there are only three files: javadoc.bat, options, and packages. The options file is the most interesting. It explicitly says UTF-8 everywhere, as it should. But look at these lines:



-sourcepath
C:/projects/li��o 1/src/main/java


This project is in C:projectslição 1. It appears that somewhere along the chain Java or Maven or the Javadoc plugin didn't correctly convert the directory name to UTF-8.



Sure enough; when I renamed the directories in Windows to remove non-ASCII characters, mvn clean package worked just fine.



This would seem like a blatant bug; once Maven starts, everything should be UTF-8 throughout. Is it a problem with the Javadoc plugin? Anyone have an idea where this originates? Where should I file a bug ticket? Or am I doing something wrong?










share|improve this question























  • First you have defined the source encoding ...the question is which encoding is given to the JVM which is used by Maven? issues.apache.org/jira/projects/MJAVADOC ?

    – khmarbaise
    Nov 23 '18 at 15:14











  • Have you tried to add <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> to <properties> block?

    – Mikhail Kholodkov
    Nov 27 '18 at 17:17











  • Can you provide me some reference to what this is supposed to do, or is this a guess of something you haven't tried?

    – Garret Wilson
    Nov 27 '18 at 22:11











  • Note that maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html is clear that encoding defaults to project.build.sourceEncoding. But we're talking about the interpretation of directory names. I think this is a bug.

    – Garret Wilson
    Nov 27 '18 at 22:13











  • Mikhail, docencoding (which is the configuration that uses the project.reporting.outputEncoding you referred to) specifies to the output encoding. How would this have anything to do with the encoding of the directory names the plugin places in the options file? Have you actually reproduced this on your machine? Have you actually seen this options file I'm talking about? Do you understand the problem?

    – Garret Wilson
    Nov 27 '18 at 22:15














5












5








5


1






I'm using OpenJDK 11 on Windows 10. I have a very simple POM, for a single Java file, that generates Javadocs. Here is an extract:



<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


Strangely just running mvn clean package causes an error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (default) on project foobar: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - cannot read Input length = 1
[ERROR]
[ERROR] Command line was: C:binjdk-11binjavadoc.exe @options @packages


In target/apidocs there are only three files: javadoc.bat, options, and packages. The options file is the most interesting. It explicitly says UTF-8 everywhere, as it should. But look at these lines:



-sourcepath
C:/projects/li��o 1/src/main/java


This project is in C:projectslição 1. It appears that somewhere along the chain Java or Maven or the Javadoc plugin didn't correctly convert the directory name to UTF-8.



Sure enough; when I renamed the directories in Windows to remove non-ASCII characters, mvn clean package worked just fine.



This would seem like a blatant bug; once Maven starts, everything should be UTF-8 throughout. Is it a problem with the Javadoc plugin? Anyone have an idea where this originates? Where should I file a bug ticket? Or am I doing something wrong?










share|improve this question














I'm using OpenJDK 11 on Windows 10. I have a very simple POM, for a single Java file, that generates Javadocs. Here is an extract:



<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


Strangely just running mvn clean package causes an error:



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (default) on project foobar: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - cannot read Input length = 1
[ERROR]
[ERROR] Command line was: C:binjdk-11binjavadoc.exe @options @packages


In target/apidocs there are only three files: javadoc.bat, options, and packages. The options file is the most interesting. It explicitly says UTF-8 everywhere, as it should. But look at these lines:



-sourcepath
C:/projects/li��o 1/src/main/java


This project is in C:projectslição 1. It appears that somewhere along the chain Java or Maven or the Javadoc plugin didn't correctly convert the directory name to UTF-8.



Sure enough; when I renamed the directories in Windows to remove non-ASCII characters, mvn clean package worked just fine.



This would seem like a blatant bug; once Maven starts, everything should be UTF-8 throughout. Is it a problem with the Javadoc plugin? Anyone have an idea where this originates? Where should I file a bug ticket? Or am I doing something wrong?







java maven maven-javadoc-plugin






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 15:08









Garret WilsonGarret Wilson

6,1421377164




6,1421377164













  • First you have defined the source encoding ...the question is which encoding is given to the JVM which is used by Maven? issues.apache.org/jira/projects/MJAVADOC ?

    – khmarbaise
    Nov 23 '18 at 15:14











  • Have you tried to add <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> to <properties> block?

    – Mikhail Kholodkov
    Nov 27 '18 at 17:17











  • Can you provide me some reference to what this is supposed to do, or is this a guess of something you haven't tried?

    – Garret Wilson
    Nov 27 '18 at 22:11











  • Note that maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html is clear that encoding defaults to project.build.sourceEncoding. But we're talking about the interpretation of directory names. I think this is a bug.

    – Garret Wilson
    Nov 27 '18 at 22:13











  • Mikhail, docencoding (which is the configuration that uses the project.reporting.outputEncoding you referred to) specifies to the output encoding. How would this have anything to do with the encoding of the directory names the plugin places in the options file? Have you actually reproduced this on your machine? Have you actually seen this options file I'm talking about? Do you understand the problem?

    – Garret Wilson
    Nov 27 '18 at 22:15



















  • First you have defined the source encoding ...the question is which encoding is given to the JVM which is used by Maven? issues.apache.org/jira/projects/MJAVADOC ?

    – khmarbaise
    Nov 23 '18 at 15:14











  • Have you tried to add <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> to <properties> block?

    – Mikhail Kholodkov
    Nov 27 '18 at 17:17











  • Can you provide me some reference to what this is supposed to do, or is this a guess of something you haven't tried?

    – Garret Wilson
    Nov 27 '18 at 22:11











  • Note that maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html is clear that encoding defaults to project.build.sourceEncoding. But we're talking about the interpretation of directory names. I think this is a bug.

    – Garret Wilson
    Nov 27 '18 at 22:13











  • Mikhail, docencoding (which is the configuration that uses the project.reporting.outputEncoding you referred to) specifies to the output encoding. How would this have anything to do with the encoding of the directory names the plugin places in the options file? Have you actually reproduced this on your machine? Have you actually seen this options file I'm talking about? Do you understand the problem?

    – Garret Wilson
    Nov 27 '18 at 22:15

















First you have defined the source encoding ...the question is which encoding is given to the JVM which is used by Maven? issues.apache.org/jira/projects/MJAVADOC ?

– khmarbaise
Nov 23 '18 at 15:14





First you have defined the source encoding ...the question is which encoding is given to the JVM which is used by Maven? issues.apache.org/jira/projects/MJAVADOC ?

– khmarbaise
Nov 23 '18 at 15:14













Have you tried to add <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> to <properties> block?

– Mikhail Kholodkov
Nov 27 '18 at 17:17





Have you tried to add <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> to <properties> block?

– Mikhail Kholodkov
Nov 27 '18 at 17:17













Can you provide me some reference to what this is supposed to do, or is this a guess of something you haven't tried?

– Garret Wilson
Nov 27 '18 at 22:11





Can you provide me some reference to what this is supposed to do, or is this a guess of something you haven't tried?

– Garret Wilson
Nov 27 '18 at 22:11













Note that maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html is clear that encoding defaults to project.build.sourceEncoding. But we're talking about the interpretation of directory names. I think this is a bug.

– Garret Wilson
Nov 27 '18 at 22:13





Note that maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html is clear that encoding defaults to project.build.sourceEncoding. But we're talking about the interpretation of directory names. I think this is a bug.

– Garret Wilson
Nov 27 '18 at 22:13













Mikhail, docencoding (which is the configuration that uses the project.reporting.outputEncoding you referred to) specifies to the output encoding. How would this have anything to do with the encoding of the directory names the plugin places in the options file? Have you actually reproduced this on your machine? Have you actually seen this options file I'm talking about? Do you understand the problem?

– Garret Wilson
Nov 27 '18 at 22:15





Mikhail, docencoding (which is the configuration that uses the project.reporting.outputEncoding you referred to) specifies to the output encoding. How would this have anything to do with the encoding of the directory names the plugin places in the options file? Have you actually reproduced this on your machine? Have you actually seen this options file I'm talking about? Do you understand the problem?

– Garret Wilson
Nov 27 '18 at 22:15












1 Answer
1






active

oldest

votes


















2





+50









As you say, this looks like the encoding used to write the files to target/apidocs.



Looking through the source for the maven-javadoc-plugin, it is just using the platform encoding when writing these files - e.g. this line.



Directly setting the encoding while calling Maven repaired the example above for me:



mvn clean package -Dfile.encoding=UTF-8


This feels more like a workaround than a good fix though - it needs to assume there is nothing else depending on the platform encoding in the Maven build.



I think the cause is a change in the main JDK between 8 and 9. The bit of code (actually under javac) that parses the argument files (e.g. @options in the javadoc command line) has switched from using the platform encoding here to calling Files.newBufferedReader() here. Files.newBufferedReader(Path) states that it uses UTF-8 if the encoding is not specified. This means argument files, in both javac and javadoc, must now be encoded in UTF-8.






share|improve this answer


























  • It would seem to me this is indeed a bug. Any idea where we can file bugs for the Maven Javadoc Plugin?

    – Garret Wilson
    Nov 29 '18 at 16:16











  • There's details about their issue tracker in Jira here. Can't spot anything obvious already there.

    – df778899
    Nov 29 '18 at 22:00











  • OK, I've filed MJAVADOC-581.

    – Garret Wilson
    Mar 3 at 0:30












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449049%2fmaven-javadoc-plugin-error-javadoc-error-cannot-read-input-length-1-with-no%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2





+50









As you say, this looks like the encoding used to write the files to target/apidocs.



Looking through the source for the maven-javadoc-plugin, it is just using the platform encoding when writing these files - e.g. this line.



Directly setting the encoding while calling Maven repaired the example above for me:



mvn clean package -Dfile.encoding=UTF-8


This feels more like a workaround than a good fix though - it needs to assume there is nothing else depending on the platform encoding in the Maven build.



I think the cause is a change in the main JDK between 8 and 9. The bit of code (actually under javac) that parses the argument files (e.g. @options in the javadoc command line) has switched from using the platform encoding here to calling Files.newBufferedReader() here. Files.newBufferedReader(Path) states that it uses UTF-8 if the encoding is not specified. This means argument files, in both javac and javadoc, must now be encoded in UTF-8.






share|improve this answer


























  • It would seem to me this is indeed a bug. Any idea where we can file bugs for the Maven Javadoc Plugin?

    – Garret Wilson
    Nov 29 '18 at 16:16











  • There's details about their issue tracker in Jira here. Can't spot anything obvious already there.

    – df778899
    Nov 29 '18 at 22:00











  • OK, I've filed MJAVADOC-581.

    – Garret Wilson
    Mar 3 at 0:30
















2





+50









As you say, this looks like the encoding used to write the files to target/apidocs.



Looking through the source for the maven-javadoc-plugin, it is just using the platform encoding when writing these files - e.g. this line.



Directly setting the encoding while calling Maven repaired the example above for me:



mvn clean package -Dfile.encoding=UTF-8


This feels more like a workaround than a good fix though - it needs to assume there is nothing else depending on the platform encoding in the Maven build.



I think the cause is a change in the main JDK between 8 and 9. The bit of code (actually under javac) that parses the argument files (e.g. @options in the javadoc command line) has switched from using the platform encoding here to calling Files.newBufferedReader() here. Files.newBufferedReader(Path) states that it uses UTF-8 if the encoding is not specified. This means argument files, in both javac and javadoc, must now be encoded in UTF-8.






share|improve this answer


























  • It would seem to me this is indeed a bug. Any idea where we can file bugs for the Maven Javadoc Plugin?

    – Garret Wilson
    Nov 29 '18 at 16:16











  • There's details about their issue tracker in Jira here. Can't spot anything obvious already there.

    – df778899
    Nov 29 '18 at 22:00











  • OK, I've filed MJAVADOC-581.

    – Garret Wilson
    Mar 3 at 0:30














2





+50







2





+50



2




+50





As you say, this looks like the encoding used to write the files to target/apidocs.



Looking through the source for the maven-javadoc-plugin, it is just using the platform encoding when writing these files - e.g. this line.



Directly setting the encoding while calling Maven repaired the example above for me:



mvn clean package -Dfile.encoding=UTF-8


This feels more like a workaround than a good fix though - it needs to assume there is nothing else depending on the platform encoding in the Maven build.



I think the cause is a change in the main JDK between 8 and 9. The bit of code (actually under javac) that parses the argument files (e.g. @options in the javadoc command line) has switched from using the platform encoding here to calling Files.newBufferedReader() here. Files.newBufferedReader(Path) states that it uses UTF-8 if the encoding is not specified. This means argument files, in both javac and javadoc, must now be encoded in UTF-8.






share|improve this answer















As you say, this looks like the encoding used to write the files to target/apidocs.



Looking through the source for the maven-javadoc-plugin, it is just using the platform encoding when writing these files - e.g. this line.



Directly setting the encoding while calling Maven repaired the example above for me:



mvn clean package -Dfile.encoding=UTF-8


This feels more like a workaround than a good fix though - it needs to assume there is nothing else depending on the platform encoding in the Maven build.



I think the cause is a change in the main JDK between 8 and 9. The bit of code (actually under javac) that parses the argument files (e.g. @options in the javadoc command line) has switched from using the platform encoding here to calling Files.newBufferedReader() here. Files.newBufferedReader(Path) states that it uses UTF-8 if the encoding is not specified. This means argument files, in both javac and javadoc, must now be encoded in UTF-8.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 1 '18 at 11:06

























answered Nov 28 '18 at 22:01









df778899df778899

8,28511129




8,28511129













  • It would seem to me this is indeed a bug. Any idea where we can file bugs for the Maven Javadoc Plugin?

    – Garret Wilson
    Nov 29 '18 at 16:16











  • There's details about their issue tracker in Jira here. Can't spot anything obvious already there.

    – df778899
    Nov 29 '18 at 22:00











  • OK, I've filed MJAVADOC-581.

    – Garret Wilson
    Mar 3 at 0:30



















  • It would seem to me this is indeed a bug. Any idea where we can file bugs for the Maven Javadoc Plugin?

    – Garret Wilson
    Nov 29 '18 at 16:16











  • There's details about their issue tracker in Jira here. Can't spot anything obvious already there.

    – df778899
    Nov 29 '18 at 22:00











  • OK, I've filed MJAVADOC-581.

    – Garret Wilson
    Mar 3 at 0:30

















It would seem to me this is indeed a bug. Any idea where we can file bugs for the Maven Javadoc Plugin?

– Garret Wilson
Nov 29 '18 at 16:16





It would seem to me this is indeed a bug. Any idea where we can file bugs for the Maven Javadoc Plugin?

– Garret Wilson
Nov 29 '18 at 16:16













There's details about their issue tracker in Jira here. Can't spot anything obvious already there.

– df778899
Nov 29 '18 at 22:00





There's details about their issue tracker in Jira here. Can't spot anything obvious already there.

– df778899
Nov 29 '18 at 22:00













OK, I've filed MJAVADOC-581.

– Garret Wilson
Mar 3 at 0:30





OK, I've filed MJAVADOC-581.

– Garret Wilson
Mar 3 at 0:30




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449049%2fmaven-javadoc-plugin-error-javadoc-error-cannot-read-input-length-1-with-no%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini