Fix the run logic so the mainClass setting is actually used when set.
Add automated tests for main-class regression.
Merge pull request #1694 from sbt/wip/mainClassBreakage

Fix the run logic so the mainClass setting is actually used when set.