function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amit "CLS"  RangariAmit "CLS" Rangari 

Compilation Error only with ANT deployment

Hi,

I have developed a simple class which refers to the global class defined by the underlying package.  I use the ANT with SF migration tools to deploy the code on my dev-org. I get following compilation error:


classes/WSMyAPI_v1.cls -- Error: Dependent class is invalid and needs recompilation:
(namespace)
namespace.class2 : line 141, column 47: Loop variable must be an SObject or list of object3__c (line 166, column 70)

Please note that this error is seen only through ANT deployment. When I deploy the code without WSMyAPI_v1.cls, succefully, and then using dev-console to paste the code from above WSMyAPI_v1.cls file, I dont get any compilation error.

Please advise! 

Regards,
Amit Rangari
Ketankumar PatelKetankumar Patel
Did you try compile all classes and see any errors you get. 

User-added image 

Setup --> Develop --> Apex Classes and click Compile all classes link.
Amit "CLS"  RangariAmit "CLS" Rangari
@Ketan!

Ketan - If I use ANT deployment with SF migration tools, the uncompiling files are not pushed on to organization.  Also, the compilation error is in other namespace, ie in a library package on which my development is dependent. I can not certainly recompile those classes.

Also, as said, the same file if I paste it to dev-console (create new class with same name) the file gets compiled and saved. 

Thus it is only the 'ANT' which is giving me trouble.