MATLAB: Is it not possible to use the deploytool to create a java library from a MATLAB scripts which relies on a predefined/static .prj file in R2015a

MATLAB Compiler

We use the DEPLOYTOOL to create a java library from our MATLAB code. We do all of this via scripts which rely on a predefined/static .PRJ file.e.g. we call deploytool -build name.prj. This has always worked fine, until 2015a.
For some reason in 2015a the prj file is modified when passed as an argument into deploytool. And the editing process removes much of the essential configuration and the build process fails. Interestingly I can get it to work if I force name.prj to be read only!
What is happening here? We know from experience that if you open a PRJ file in the Application Compile GUI then the file is modified (checksum, some paths etc). But this hasn't ever happened when running from the command line.

Best Answer

There is a bug in deploytool in R2015a, please apply the attached patch.
Our expectation is that a PRJ file is created in a MATLAB instance where the user is able to run their M code. For example, they have tested it in the MATLAB session and are now ready to deploy it. Part of that expectation is that the matlabpath for the MATLAB instance they are creating the PRJ in is the matlabpath that they expect to compile with and it is properly set up.
In this particular case, the PRJ might have been put together at some time in the past and the matlabpath may have gotten out of sync with what it was when the PRJ was created.
A possible workaround is to put the path into the PRJ file. When executing deploytool.exe, it looks for the path declaration in the PRJ, and uses that if it finds it. If does not find it there, it resorts to the matlabpath that is stored in the user's preferences.