Sometimes, when trying to build nad push the code, Ant will complain about the build failing. This can occur for multiple reasons. Luckily, most of the time, the fix is easy.
How to Fix It
As stated above, which path you take below will depend on the nature of the error.
Go to the build.properties file and edit the user and password fields. Make sure that the user you choose has permission to edit the .jar file (such as lvuser or root).
roboRIO not found
Make sure that you have a connection with the robot (i.e. make sure that both the roboRIO and the radio are on and that you are connected to the robot's network). If you are and the problem persists, make sure that Ant is trying to access the correct IP address. Try editing the build.properties file to send it to the correct static IP. You could also sketchily just send the code over via USB or Ethernet, but this should be a last resort.
roboRIO Image does not match plugin
Update WPILib. In eclipse, go to Help > Check for updates.
Make sure that you aren't running into an error during the actual compilation stage.
A bunch of blue and orange text (about JSON or other dependencies)
You need to add your json jar (or other library jar) to the (User)/wpilib/user/java/lib folder.
Outdated method (2016 and earlier) \/
Refer to the Build.properties and build.xml page. The libraries have not been added to the ant classpath, so the robot does not have the JSON (or other) libraries it needs.
Java Deploy Fail (JRE)
Reinstall the JRE on the roboRIO.