Well the Maven build shouldn’t care at all as the output path is always set in 
the build and it’s never built using the CWD as for a maven multi-module build 
is always the directory where the build was started (so in case of a 
multi-module build it could be some directory other than the current modules 
directory)

Chris

Am 11.01.17, 20:51 schrieb "Josh Tynjala" <joshtynj...@gmail.com>:

    MXMLFlexJSPublisher contains the following code that is run when no output
    path is specified in the compiler options:
    
    //begin code
    String mainClassFolder = configuration.getTargetFileDirectory();
    if (mainClassFolder.endsWith("src"))
        outputParentFolder = new
    File(configuration.getTargetFileDirectory()).getParentFile();
    else if (mainClassFolder.endsWith("src/main/flex") ||
    mainClassFolder.endsWith("src\\main\\flex"))
        outputParentFolder = new
    
File(configuration.getTargetFileDirectory()).getParentFile().getParentFile().getParentFile();
    else
        outputParentFolder = new File(configuration.getTargetFileDirectory());
    //end code
    
    In plain English:
    
    1. If the main class is in a src directory, bin will be created in the
    parent directory of src.
    
    2. If the main class is in a src/main/flex directory (in other words, if
    it's a Maven project), bin will be created in ../../..
    
    3. Otherwise, bin will be created in the same directory as the main class.
    
    I often use "source" rather than "src", so I was getting source/bin as my
    output directory, which was unexpected.
    
    Rather than hardcoding a couple of special paths, maybe we should create
    bin relative to the current working directory instead. I think that's a
    common behavior for command line tools.
    
    With this change, both of these commands should continue to work exactly
    the same way:
    
    mxmlc src/Main.mxml
    mxmlc src/main/flex/Main.mxml
    
    I assume that Maven sets the CWD to the correct location before it runs the
    compiler too.
    
    This would also allow other build tools with different project structures
    to work without modifying the compiler.
    
    Thoughts?
    
    - Josh
    

Reply via email to