Eclipse is an open source development community. If you have not already done so, download and install Eclipse on your development machine. For more information, see Eclipse and Eclipse IDE for Java Developers.
Create a directory on your development machine (for example "mypig") and checkout the Pig source from SVN: http://svn.apache.org/repos/asf/pig/trunk
Generate eclipse files:
ant clean eclipse-files
Pre-compile and generate sources
ant compile gen
Import Pig project into Eclipse
- Open Eclipse
- Select File->Import
- Select General->Existing Projects Into Workspace
- Select root directory (point to <top-level-directory>)
- Click Finish
Run Pig Main
- Create a new Run Configurations
- Pick "org.apache.pig.Main" as the Main class
Run Pig Unit test
- Create a new Junit Run Configurations, pick any Pig test suite as "Test class"
- In "VM arguments", put "-Xmx1024m"
- Change "Working directory" into your PIG_HOME
- In Classpath, add user entries "$PIG_HOME/build/classes" and "$PIG_HOME/pig*.jar"
- Build problems: Check if eclipse is using JDK version 1.6, pig needs it (Under Preferences/Java/Compiler).
- If you encounter this error: Missing required library: 'build/ivy/lib/Pig/javacc-4.2.jar' try one of the solutions described in PIG-3399.