I am getting a configured package.xml file from force.com IDE and while using the same package.xml file to deploy changes from another folder ANT is checking all the metadata. I know that the tool works like that but how do I create an ant task which copies only required files to another directory?
Here is a sample piece of code that I wrote and you can extend it further for your needs.
<!-- Create sub folder called classes --> <target name="createClassesFolder"> <mkdir dir="tempFolder/Classes"/> </target> <!-- Copy contents of classes folder from source folder --> <target name="moveClassesFolder" depends="createClassesFolder"> <copy todir="ClassesRootFolder/Classes"> <fileset dir="../src/classes"/> </copy> </target>
Here is how it works:
- To use this code you should have a folder named
- When you run the target
createClassesFolder, it will create a sub folder named
- Now run the target
moveClassesFolderand this will copy all the contents of
classesfolder from your source folder to the tempFolder created in step 1.
Please note how I used
../src/classes because I am not running these commands from the same directory as src folder but one directory above.
- You can also similarly create another target to copy package.xml from source folder to the tempFolder.
With all these steps in place, you should be able to just deploy only classes folder and then don't forget to use
allowMissingFiles=true attribute because we are using the same package.xml but deploying only subset of it.