project's output directory cannot be set to absolute path
---------------------------------------------------------

                 Key: MNG-3646
                 URL: http://jira.codehaus.org/browse/MNG-3646
             Project: Maven 2
          Issue Type: Bug
    Affects Versions: 2.0.8
            Reporter: Ittay Dror


I want to be able to set the output (target) directory to some absolute path 
outside of the source tree. What I'm trying to do is set <build><directory> to 
${output}/${project.artifactId}/${project.groupId}, where 'output' is passed 
from the command line. 

Looking at the 2.0.8 code, this is what happens:
* DefaultMavenProjectBuilder.buildInternal calls 
pathTranslator.alignToBaseDirectory( project.getModel(), 
projectDescriptor.getParentFile() );
* DefaultPathTranslagor.alignToBaseDirectory calles build.setDirectory,  
build.setSourceDirectory and build.setTestSourceDirectory all with calling the 
method alignToBaseDirectory(String, File) where the string is the current value 
of the above and File is the base directory
* alignToBaseDirectory(String, File) calls requiresBaseDirectoryAlignment with 
the string
* requiresBaseDirectoryAlignment constructs a File on top of the string and 
then calls File.isAbsolute to find if the path is absolute
* since a path in the form of "${something}" is not considered by File to be 
absolute, alignToBaseDirectory adds basedir to the path.

So the final result is that passing -Doutput=/tmp results in the output 
directory being set to something like /home/ittayd/dev/tmp/com.company/artifact 
which is not what I intended. 

I can go around this in linux by using 
'/${output}/${project.artifactId}/${project.groupId}', but this won't work in 
windows (for two reasons: 1. '/' is not interpreted as a path separator (in 
Win32FileSystem) and 2. even if it did, it will not allow setting output to 
'D:\TEMP')



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to