You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Alexey Krasnoriadtsev <Al...@first-franklin.com> on 2003/10/06 19:01:37 UTC

Problem with Current Working Directory

Hi All,

I am not familiar with Maven internals, and was wondering if any one can
explain me the issue (and possible solution) that I'm experiencing.

After the invoking ant from a different directory, maven "stays" there. And
when org.apache.velocity.texen.util.FileUtil is used with relative path,
the file is created in the directory where ant was invoked from, not the
${basedir}

Why is it a problem for me? 
Well, fileutil.file(fullSrcDir).getAbsolutePath() is used on checkstyle and
PMD to determine the package names, and create broken links, because of the
wrong directory.
Here is some code to back it up:

Maven.xml 
<snip>
<preGoal name="site">	        
        <echo> src.ant.dir -- ${src.ant.dir} </echo>
        <ant antfile="build.xml" dir="${src.ant.dir}" target="clean" />
        <!-- <ant antfile="build.xml" dir="${src.ant.dir}"
target="src-checkout" />  -->
        <echo>base  ${basedir}</echo>        
        <j:set var="fullSrcDir" value="${pom.build.sourceDirectory}"/>
        <echo>full ${fullSrcDir} </echo>
        <j:set var="srcDir"
value="${fileutil.file(fullSrcDir).getAbsolutePath()}"/>
        <echo>srcDir = ${srcDir} </echo>
        <j:set var="curr" value="." />
        <j:set var="dir" value="${fileutil.file(curr).getAbsolutePath()}" />
        <echo>Current Dir -- ${dir} </echo>
        
</preGoal>

    [echo]  src.ant.dir -- /export/home/bp/projects/cs/src/ant
    [echo] base  /export/home/bp/projects/cs
    [echo] full src/java
    [echo] srcDir = /export/home/bp/projects/cs/src/ant/src/java
    [echo] Current Dir -- /export/home/bp/projects/cs/src/ant/.
    [echo] Site
BUILD SUCCESSFUL



Alex Krasnoriadtsev
Application Development
408-964-1564


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org