Rename Phase -> Goal.

This change deals with phase.py (now goal.py) and things that
depend on it.

CI passes: https://travis-ci.org/pantsbuild/pants/builds/32484729

Future mop-up changes will fix extant uses of the term 'phase'
in various files, and also fix documentation appropriately.

Reviewed at https://rbcommons.com/s/twitter/r/887/
Rename the ':phase' target to ':goal'.

Reviewed in https://rbcommons.com/s/twitter/r/890/.
Fixup JvmRun  only-write-cmd-line flag to accept relative paths.

Introduce expand_path fs utility and use it on JvmRun.
Add tests for this new util and JvmRun's cmdline-only mode.

Testing Done:
$ PANTS_DEV=1 ./pants goal test tests/python/pants_test/tasks/:jvm_run tests/python/pants_test/fs --test-pytest-options="-v -k'test_jvm_run or test_expand_path'"
...
11:10:49 00:00   [test]
11:10:49 00:00     [pytest]
11:10:49 00:00       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.6.9 -- py-1.4.23 -- pytest-2.6.1 -- /usr/bin/python2.6
                     plugins: cov, timeout
                     collected 12 items

                     tests/python/pants_test/fs/test_expand_path.py::ExpandPathTest::test_absolute PASSED
                     tests/python/pants_test/fs/test_expand_path.py::ExpandPathTest::test_dot_relative PASSED
                     tests/python/pants_test/fs/test_expand_path.py::ExpandPathTest::test_env_var_expansion PASSED
                     tests/python/pants_test/fs/test_expand_path.py::ExpandPathTest::test_pure_relative PASSED
                     tests/python/pants_test/fs/test_expand_path.py::ExpandPathTest::test_user_expansion PASSED
                     tests/python/pants_test/tasks/test_jvm_run.py::JvmRunTest::test_cmdline_only PASSED

                      6 tests deselected by '-ktest_jvm_run or test_expand_path'
                     ===== 6 passed, 6 deselected in 0.19 seconds =====

11:10:50 00:01     [junit]
11:10:50 00:01     [specs]
               SUCCESS

Bugs closed: 494, 495

Reviewed at https://rbcommons.com/s/twitter/r/908/
Fixup always True test.

I horked this in diff 2 of https://rbcommons.com/s/twitter/r/908/

commit 6ad878ccbc6654be068e3670feca659de4dbb41d
Author: John Sirois <jsirois@twitter.com>
Date:   Mon Aug 18 12:38:27 2014 -0600

    Fixup always True test.

 tests/python/pants_test/tasks/test_jvm_run.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Testing Done:
$ PANTS_DEV=1 ./pants goal test tests/python/pants_test/tasks/:jvm_run --test-pytest-options=-v
...
13:25:44 00:01   [test]
13:25:44 00:01     [pytest]
13:25:44 00:01       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.6.9 -- py-1.4.23 -- pytest-2.6.1 -- /usr/bin/python2.6
                     plugins: cov, timeout
                     collected 1 items

                     tests/python/pants_test/tasks/test_jvm_run.py::JvmRunTest::test_cmdline_only PASSED

                     ============ 1 passed in 0.17 seconds ============

13:25:45 00:02     [junit]
13:25:45 00:02     [specs]
               SUCCESS

Bugs closed: 494, 496

Reviewed at https://rbcommons.com/s/twitter/r/911/
Clean up almost all extant uses of the obsolete term 'phase'.

The only remaining ones are in builddictionary.py and its test,
goals_reference.mustache, and various .rst files.

Reviewed in https://rbcommons.com/s/twitter/r/910/.
Fix documentation references to "phase".

Removes references to the old Goal (now TaskRegistrar) class, as it's
no longer an important concept. All the reader needs to know about
are Goals (formerly Phases) and Tasks.

Also fixed some incorrect/out-of-date documentation around GroupTasks.

Reviewed at https://rbcommons.com/s/twitter/r/913/
Fix eclipse_gen idea_gen for targets with both Java and Scala

eclipse_gen.py was completely broken:
* Use self.context instead of argument (fixes 1d68bf9d0c)
* Add missing templates
* Fix paths to jars in generated .classpath
* Add test_eclipse_integration.py based on test_idea_integration.py

Both Eclipse and IntelliJ generators were broken for targets that depend on a
library with both Scala and Java source code. They failed to add the Java
dependencies.

ide_gen.py: recurse into Java source dependencies for ScalaLibraries
scaladepsonboth: Example target that depends on a mixed Scala/Java project

Testing Done:
PANTS_DEV=1 ./pants goal test tests/python/pants_test/tasks:integration

I also verified that both IntelliJ and Eclipse can build the generated project for src/scala/com/pants/testproject/scaladepsonboth. The current master doesn't work on either, due to missing a Java source dependency.

Reviewed at https://rbcommons.com/s/twitter/r/857/
Remove all references to phase from builddict and related docs.

Phase is now goal, and goal is now task.

Testing Done:
Ran the unit tests.

Generate the docs locally and clicked around them manually to verify that the text makes sense, hyperlinks work etc.

Reviewed at https://rbcommons.com/s/twitter/r/915/
Remove some BUILD file aliases.

There should be no reason to need these in BUILD files.

Also removed a test that relied on one of the removed aliases. This
test wasn't really testing anything anyway. We don't support registering
tasks in BUILD files any more.

Testing Done:
All unittests. CI baking.

Reviewed at https://rbcommons.com/s/twitter/r/912/
Fixup EclipseGen resources globs to include prefs.

Also upgrade PantsRunIntegrationTest to unittest2.

Testing Done:
$ PANTS_DEV=1 ./pants goal test tests/python/pants_test/tasks:eclipse_integration --test-pytest-options='-vs'
...
16:50:51 00:01   [test]
16:50:51 00:01     [pytest]
16:50:51 00:01       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.6.9 -- py-1.4.23 -- pytest-2.6.1 -- /usr/bin/python2.6
                     plugins: cov, timeout
                     collected 9 items

                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_all_examples PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_annotations PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_hello PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_java_sources PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_jaxb PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_protobuf PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_scaladepsonboth PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_thriftdeptest PASSED
                     tests/python/pants_test/tasks/test_eclipse_integration.py::EclipseIntegrationTest::test_eclipse_on_unicode PASSED

                     =========== 9 passed in 19.66 seconds ============

16:51:11 00:21     [junit]
16:51:11 00:21     [specs]
               SUCCESS

Travis CI went green here: https://travis-ci.org/pantsbuild/pants/builds/32908116

Bugs closed: 497

Reviewed at https://rbcommons.com/s/twitter/r/916/
this might help Twitter's internal Pants to see the resources useful for markdown goal

Inside Twitter, './pants goal markdown' fails trying to load the page.mustache resource file.
But './pants goal builddict' works, and I know that uses resources.
I see that when TDesai fixed some resource-breakage, she edited this section.
And I see that this section mentions templates/builddictionary but not templates/markdown, so I'm hopeful; even though I'm vague about some (most?) parts of the pants->internal pants ritual.

Testing Done:
https://travis-ci.org/pantsbuild/pants/builds/32912323

Bugs closed: 498

Reviewed at https://rbcommons.com/s/twitter/r/918/
Make :: fail for an invalid dir much like : does for a dir with no BUILD file.

Testing Done:
$ PANTS_DEV=1 ./pants goal test tests/python/pants_test/base/:cmd_line_spec_parser --test-pytest-options=-v
...
17:20:09 00:00   [test]
17:20:09 00:00     [pytest]
17:20:09 00:00       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.6.9 -- py-1.4.23 -- pytest-2.6.1 -- /usr/bin/python2.6
                     plugins: cov, timeout
                     collected 7 items

                     tests/python/pants_test/base/test_cmd_line_spec_parser.py::CmdLineSpecParserTest::test_absolute PASSED
                     tests/python/pants_test/base/test_cmd_line_spec_parser.py::CmdLineSpecParserTest::test_cmd_line_affordances PASSED
                     tests/python/pants_test/base/test_cmd_line_spec_parser.py::CmdLineSpecParserTest::test_cmd_line_spec_list PASSED
                     tests/python/pants_test/base/test_cmd_line_spec_parser.py::CmdLineSpecParserTest::test_does_not_exist PASSED
                     tests/python/pants_test/base/test_cmd_line_spec_parser.py::CmdLineSpecParserTest::test_normal PASSED
                     tests/python/pants_test/base/test_cmd_line_spec_parser.py::CmdLineSpecParserTest::test_sibling PASSED
                     tests/python/pants_test/base/test_cmd_line_spec_parser.py::CmdLineSpecParserTest::test_sibling_or_descendents PASSED

                     ============ 7 passed in 0.10 seconds ============

17:20:43 00:34     [junit]
17:20:43 00:34     [specs]
               SUCCESS

And travis CI went green here: https://travis-ci.org/pantsbuild/pants/builds/32910349

Bugs closed: 484, 492

Reviewed at https://rbcommons.com/s/twitter/r/907/
Fixed 'pants goal targets'

As Jin pointed out in issue 333, pants goal targets is broken. Its pretty easy to patch it up, but it relies on a fixed list of alias-> target classes, which is ugly and seemingly redundant.

Larry says we could just remove it. Or we could try to keep it going. I'm fine with either decision, I just don't like broken commands sitting around, I think it sets bad precedent.

Testing Done:
added test to ci.sh, its green: https://travis-ci.org/pantsbuild/pants/builds/32858261

Bugs closed: 493

Reviewed at https://rbcommons.com/s/twitter/r/914/
Properly order resources for pants goal test and pants goal run.

Fixed a problem with goal run and test for resources being put on the classpath in the
wrong order when multiple resource paths contain the same resource path.

Added a project with resources that collide and an integration test to prove
that resources are bundled and added to the classpath in the right order.

Note that the JVM tests will still fail if all run together with

   pants goal test maven_src/resource_collision::

because pants runs all the tests in the same junit test runner instance.