java - Some clarifications about how ant copy some files into a folder? -


this question exact duplicate of:

i pretty new ant (i came maven , ant nightmare me !!!)

i have target:

<target name="linuxdriver"     description="linux driver">     <copy file="${deps.linuxdriver.dir}/${deps.linuxdriver.name}"           tofile="${project.datadir}/${deps.linuxdriver.name}"/>     <copy file="${deps.linuxdriver.dir}/${deps.linuxdriver.name}"           tofile="${project.deploy}/data/${deps.linuxdriver.name}"/>     <chmod perm="+x" file="${project.datadir}/${deps.linuxdriver.name}"/>     <chmod perm="+x" file="${project.deploy}/data/${deps.linuxdriver.name}"/> </target> 

and have property file in there definied "variable" (are named variable?) used in previous ant code, have:

project.datadir = ${basedir}/data  project.deploy.dir = release  project.deploy = ${basedir}/../${project.deploy.dir}  deps.linuxdriver.name = atmosfs 

and have doubts:

1) represents ${basedir}? specific directory? what? reading on ant manual (http://ant.apache.org/manual/properties.html) is: the absolute path of project's basedir (as set basedir attribute of ).

so, absolute path of project in eclipse workspace?

2) using previous information 2 destination folder in files copied (using "copy file...to file" tag)?

1) represents ${basedir}? specific directory?

yes. ${basedir} directory either started ant, or directory specified in <project> entity on top of ant file. normally, set "." makes same directory directory contains ant build file.

2) using previous information 2 destination folder in files copied (using "copy file...to file" tag)?

you didn't list whole ant file, , whole properties file. i'm not sure if properties file read in (you need <property file="xxxx.properties"/> near top of ant file).

assuming executing in same directory ant file, , ${basedir} same directory ant file:

<copy file="${basedir}/atmosfs/atmostfs"     verbose="true"     tofile="${basedir}/release/atmosfs"/> <copy file="${basedir}/atmofs/atmofs"     verbose="true"     tofile="${basedir}/../release/data/atmofs"/> 

again, assuming ${basedir} directory antfile stored, , executing script directory.

notice have verbose="true" in <copy>. recommend make change. show file being copied , when <copy> executed. it's best way handle this.

by way, 1 rule have action takes place in project tree. last tofile being written outside of project directory (where assume ant file located). imagine checking out project, , finding out build process wrote file outside of checked out directory , onto computer in random place. doing considered impolite.

even more polite write files , build processing under subdirectory. people use build, prefer target because that's maven standard. idea can clean entire build process deleting 1 directory.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -