[ 
https://issues.apache.org/jira/browse/MCOMPILER-242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Elliotte Rusty Harold resolved MCOMPILER-242.
---------------------------------------------
    Resolution: Won't Fix

This is a JDK bug, if anything

> Add option to force consistent ordering of source files
> -------------------------------------------------------
>
>                 Key: MCOMPILER-242
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-242
>             Project: Maven Compiler Plugin
>          Issue Type: New Feature
>    Affects Versions: 3.3
>            Reporter: Richard DiCroce
>            Priority: Major
>
> In theory, the order in which source files are compiled should not matter. In 
> practice, there are issues like 
> [JDK-8067422|https://bugs.openjdk.java.net/browse/JDK-8067422] in which 
> compilation order does matter. That issue does not affect the functionality 
> of the compiled class, but does result in different output. This is a problem 
> if you need to create a strictly reproducible build, by which I mean it 
> should be possible to repeat a build and have the checksum for all files be 
> identical.
> Adding such an option would require changes in both maven-compiler-plugin and 
> plexus-compiler-api. Specifically, the method 
> org.codehaus.plexus.compiler.AbstractCompiler#getSourceFiles(CompilerConfiguration)
>  needs to have a check added at the end. Depending on the value of some 
> option in the configuration, it should sort the result array to ensure 
> consistent ordering. The ability to set that option would then be exposed by 
> maven-compiler-plugin.
> I have hacked in such an option without changing maven-compiler-plugin (for 
> simplicity) 
> [here|https://github.com/rdicroce/plexus-compiler/tree/sort-source-files], 
> but it would be nicer if the option were properly exposed. The choice of 
> "-XDsortFiles" comes from the very undocumented javac option of the same 
> name, which is supposed to do the same thing but appears to only have an 
> effect if javac itself needs to walk the directory tree to discover source 
> files.
> Note that, without this change, compilation order is still consistent as long 
> as the files have the same absolute path every time they are compiled. So, 
> for example, if you check out a project and compile it multiple times from 
> "C:/sources/foo", the output will always be the same. But if you check out 
> the project into "C:/other-sources/foo", the order will be different.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to