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
VeMan1542VeMan1542 

ANT deploy problems

I am trying to deploy an APEX trigger and class using ANT. I've done this before and gotten it to work, which is why I'm puzzled as to why it's not working now.
 
The error message I'm getting is:
 
Target "LeadCleaner2" does not exist in the project "LeadCleaner2".
 
I've created a build.xml file in which the project is called "LeadCleaner2", and which references a class called "LeadCleaner2.apex" in my Classes folder, as well as the "LeadCleaner2.tgr" trigger in the Triggers folder. My Build.xml file reads:
 

<project name="LeadCleaner2" basedir="." xmlns:sf="antlib:com.salesforce">

<property file="build.properties"/>

<property environment="env"/>

<!-- Deploy to server -->

<target name="deploy">

<sf:compileAndTest username="${sf.username}" password="${sf.password}" server="${sf.serverurl}" apiversion="12.0"

baseDir=".">

<runTests>

<class>LeadCleaner2</class>

</runTests>

</sf:compileAndTest>

</target>

<!-- Cleans up above. (Deletes can be combined with compiles.) -->

<target name="delete">

<sf:compileAndTest username="${sf.username}" password="${sf.password}" server="${sf.serverurl}" apiversion="12.0">

<deleteClass>LeadCleaner2</deleteClass>

<deleteTrigger>LeadCleaner2</deleteTrigger>

</sf:compileAndTest>

</target>

</project>

 

What am I doing wrong, and how is it the LeadCleaner project in the build.xml file doesn't reference the LeadCleaner2 class and trigger?

Anand BNAnand BN
What command are you using to run your "ant deploy"? It looks from the error message that you are possibly doing "ant LeadCleaner2". Ant is looking for a Target named "LeadCleaner2" which doe'snt exists.
 
could you post the command you are using and the entire log from Ant when you run the command.
 
VeMan1542VeMan1542
    I was using "ANT deploy LeadCleaner2 -verbose"

What's weird though is that in spite of the 'BUILD FAILED' and the error message I provided, the trigger and class were both deployed anyway into production. I remember seeing upper and lower case variations of how I wrote 'LeadCleaner2", so I'm wondering if the ANT command is case sensitive when checking the name in the build file, the name in the trigger and class files, as well as how I wrote it in the command.

Fortunately (or not) I was able to load and delete the trigger as necessary, but I still don't understand the error message or why it loaded the trigger and class even though the Build Failed.