I am using ANT to build an xml file but get the following error:
Error:[LoginFault [ApiFault exceptionCode='INVALID_LOGIN' exceptionMessage='Invalid username, password, security token; or user locked out.' extendedErrorDetails='{[0]}
I did the following
- Whitelisted IP
- Simplified my password
- Tried password with token
- Soql PermissionSetAssignment ModifyAllData = true, was true for user
The user login settings shows
Partner Product Invalid Password Force.com Migration Tool login.salesforce.com
Build.properties
sf.username = username
sf.password = pasword
sfprod.serverurl = https://login.salesforce.com
sfsandbox.serverurl = https://test.salesforce.com
sf.maxPoll = 20
Build.xml
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="build.properties"/>
<property environment="env"/>
<!-- Setting default value for username, password and session id properties to empty String
so unset values are treated as empty. Whitout this, ant expressions such as ${sf.username}
will be treated literally
-->
<condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
<condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
<condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>
<taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
<classpath>
<pathelement location="../ant-salesforce.jar" />
</classpath>
</taskdef>
<!-- Retrieve package.xml file from a sandbox org -->
<target name="retrieveSandbox">
<mkdir dir="deploy"/>
<!--Retrieve the contents into another directory -->
<sf:retrieve username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sfsandbox.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="deploy" unpackaged="retrieve/package.xml"/>
</target>
<!-- Retrieve package.xml file from production -->
<target name="retrieveProd">
<mkdir dir="deploy"/>
<!-- Retrieve the contents into another directory -->
<sf:retrieve username="${sf.username}" password="{sf.password}" sessionId="${sf.sessionId}" serverurl="${sfprod.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="deploy" unpackaged="retrieve/package.xml"/>
</target>
<!-- Shows deploying code & running tests for code in directory -->
<target name="deploySandbox">
<!-- Upload the contents of the "codepkg" directory, running the tests for just 1 class -->
<sf:deploy username="${sf.username.deploy}" password="${sf.password.deploy}" sessionId="${sf.sessionId}" serverurl="${sfsandbox.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="deploy" rollbackOnError="true" TestLevel="NoTestRun">
</sf:deploy>
</target>
<!-- Shows deploying code & running tests for code in directory -->
<target name="deployProd">
<!-- Upload the contents of the "codepkg" directory, running the tests for just 1 class -->
<sf:deploy username="${sf.username.deploy}" password="${sf.password.deploy}" sessionId="${sf.sessionId}" serverurl="${sfprod.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="deploy" rollbackOnError="true" TestLevel= "NoTestRun">
</sf:deploy>
</target>
<target name="validateSandbox">
<sf:deploy username="${sf.username.deploy}" password="${sf.password.deploy}" sessionId="${sf.sessionId}" serverurl="${sfsandbox.serverurl}" maxPoll="${sf.maxPoll}"
deployRoot="deploy" checkOnly="true" TestLevel= "NoTestRun"/>
</target>
<target name="validateProd">
<sf:deploy username="${sf.username.deploy}" password="${sf.password.deploy}" sessionId="${sf.sessionId}" serverurl="${sfprod.serverurl}" maxPoll="${sf.maxPoll}"
deployRoot="deploy" checkOnly="true" TestLevel= "NoTestRun"/>
</target>
</project>