how can I disable javadoc call when using MCC to build javabuilder app?

3 次查看(过去 30 天)
There is a legacy app that we are running for a customer that builds a matlab project into a jar. Our current build scripts have been working well but we are moving to a new jenkins server and the main mcc command now throws an error:
working/tmp/MYAPPLib/MYAPPLib/package-info.java:9: error: heading used out of sequence: <H3>, compared to implicit preceding heading: <H1>
* <h3><b>IMPORTANT: </b>What you need to use this package successfully:</h3>
1 error
2 warnings
The following command:
javadoc" -d "working/tmp/MYAPPLib/doc/html" -sourcepath "working/tmp/MYAPPLib" -classpath "/opt/matlab/R2021a/toolbox/javabuilder/jar/javabuilder.jar" MYAPPLib
failed with error code 1.
This may occur if Java is not installed, or incorrectly installed, or not on the system path,
or if the environment variable JAVA_HOME is set to an incorrect value.
I am running the following command (split into lines for clarity):
mcc -v
-W 'java:MYAPPLib,Class1'
-T link:lib
-d working/tmp/MYAPPLib/ class{Class1:main/main_MYAPP.m}
-a algoFun
-a algoFun/parameters.mat
-a classes
-a proj/JavaLibrary1/target/JavaLibrary1.jar
-a eqFun
-a ioFun
-a proj/JavaLibrary2/target/JavaLibrary2.jar
-a tools
-a truth
-a types
-a proj/JavaLibrary3/target/JavaLibrary3.jar
-a utilFun
We don't need the javadoc to be produced but I cannot find anything in the javabuilder or mcc documentation that mentions javadoc at all. How would I go about preventing mcc from running the javadoc command? As this is code generated during the mcc there is no way for me to edit the offending file and fix the javadoc.
Thanks.

回答(2 个)

Swastik Sarkar
Swastik Sarkar 2025-5-28
编辑:Swastik Sarkar 2025-5-28
Hi Jim,
I was also looking for an option to disable the generation of Javadocs during the mcc compilation process, but no such feature currently exists in MATLAB Compiler.
Due to this limitation, if an error occurs during compilation, MATLAB automatically removes any partially generated files, including Java files. This behavior can hinder workflows that rely on Java outputs.
As a workaround, the -K flag can be used with the mcc command. This flag prevents MATLAB from deleting intermediate files when a compilation error occurs, allowing those files to be accessed and used after the mcc step.
Further information on the -K flag can be found in the below MATLAB documentation:
Hope this helps clarify the issue.

Jim Ford
Jim Ford 2025-5-28
编辑:Jim Ford 2025-5-28
here is the hacky workaround that I found:
# delete the javadoc executable
rm ${JAVA_HOME}/bin/javadoc
# create empty file in it's place
touch ${JAVA_HOME}/bin/javadoc
# make the empty file executable
chmod +x ${JAVA_HOME}/bin/javadoc
For me this is going to work as I am running the build inside a docker container.
It's stupid.
It's hacky.
It should NOT be necessary.
My biggest frustration here is that MCC is INCORRECTLY generating the javadoc that the javadoc command is failing on and there is no way to disable it.
Second biggest frustration, literally ZERO official responses on this question in 2 weeks.
Yet another reason I will NEVER recommend matlab to anyone ever.

类别

Help CenterFile Exchange 中查找有关 Licensing on Cloud Platforms 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by