The Battle of the Wilderness was the first encounter of Lieutenant General Ulysses S. Grant and General Robert E. Lee 's forces , during Grant 's Overland Campaign in May and June 1864 during the American Civil War .