简体   繁体   中英

isDirectory returns false for ant task on a folder under svn

Hello i'm running an ant task through eclipse that generates some code but the error i'm getting is on the arguments checking

build/classes is not a readable directory

relevant code is:

if (!destDirectory.isDirectory()) { 
   error(destDirectory.toString() + " is not a readable directory");
}

I'm doing this under Windows 7 and the folder is under svn and a shared folder to CentOS with VirtualBox. The directory is created by another ant task that just does mkdir .

i'm running has user but with UAC off and has far i can tell there shouldn't be any problems with permissions.

EDIT:

some parts of the ant file:

<project name="xpto" default="compile" basedir=".">
  <target name="prepare">
    <echo message="Preparing the project for build..."/>
    <mkdir dir="${classes.build.rel-dir}"/>
    <mkdir dir="${db.rel-dir}"/>
    <mkdir dir="${build.rel-dir}" />
    <mkdir dir="${dist.dir}" />
  </target>
  <property name="src.rel-dir" value="src"/>
  <property name="build.rel-dir" value="build"/>
  <property name="classes.build.rel-dir" value="${build.rel-dir}/classes"/>
  <target name="instrument-classes" depends="compile">
    <dml-post-processor dir="${classes.build.rel-dir}">
      <fileset file="${dml.rel-file}"/>
      <classpath refid="project.classpath" />
    </dml-post-processor>
  </target>
</project>

so i think the path is correct and will use ./build/classes

EDIT:

instrument-classes:
  [echo] Injecting FenixFramework Voodoo Magic...
  [echo] path -> build/classes

the output of running echo on ${classes.build.rel-dir}

I experienced this problem using a familiar framework (fenix) when using the ant-plugin for eclipse. In fact, the plugin seems to 'run' ant from another different directory. Still, running ant from command-line (in windows7) seems to work for me.

So, the solution is to use the ${basedir} variable in the build.xml script, for well-defined paths.

example:

<property
    name="dir.project.java"
    value="${basedir}/src/project/" />

instead of:

<property
    name="dir.project.java"
    value="src/project/" />

Sorry about an outdated reply.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM