Differences between revisions 1 and 16 (spanning 15 versions)
Revision 1 as of 2005-02-10 05:33:54
Size: 1511
Editor: ClarkUpdike
Comment:
Revision 16 as of 2008-05-13 23:45:47
Size: 4588
Editor: 70
Comment: rip out stuff about ant.properties that is more confusing than helpful
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
= Jython via CVS in Eclipse =
Eclipse is a CVS client and can be used to get the project from the repository. It takes a few steps to set it up, but seems to work nice once you do. Please correct any mistakes. (Works for Eclipse 3.0.1)
= Setting up the jython development environment in Eclipse =
Eclipse has a plugin to become a SVN client and can be used to get the project from the repository. It takes a few steps to set it up, but seems to work well once you do. Please correct any mistakes. (Works for Eclipse 3.1-3.3)
Line 5: Line 5:
 *`File -> New -> New Project -> CVS folder (expand) -> Checkout Projects from CVS -> Next`
 *Set up the repository properties
  *Host: `cvs.sourceforge.net`
  *Repository Path: `/cvsroot/jython`
  *User: `anonymous`
  *Password: <leave blank>
  *Connection type: `pserver`
  *Use Default Port <the default>
  *Click `Next`
 *Create the project
  *Select `Use an existing module (..)`
  *Select `jython`
  *Click `Next`
  *Select `Check out as a project in the workspace` [[FootNote(I tried using `Check out as a project configured using the New Project Wizard` but it put me in an endless loop.)]]
  *Click `Next`
  *Click `Next`
 *Now, scan files from the repository to find tags from the repository by scanning them from files>
  *Select `HEAD`
  *Click `Configure Tags`
  *Drill down into `org.python.core` and select `__builtin__.java`
   You should see a list of tags (`Versions`, `Branches`)checked in the upper right hand pane.
  *Click `Add Checked Tags` to make the CVS plugin aware of them
  *Click `OK`
  Eclipse scans the selected file and pulls out all of the available tags.
 *Checkout the tag you want into the project
  *Select the branch or version you want (drill down)
  *Click `Finish`
== Installing the Subclipse plugin ==

 * Go to Help -> Software Updates -> Find and Install...
 * Go to Search for new features to install
 * Add a new remote site: http://subclipse.tigris.org/update_1.2.x (see http://subclipse.tigris.org/callisto.html for more details)
 * Install the plugin by selecting the product from the subclipse site.

== Checking out the Jython project ==

 * Switch to SVN Repository Exploring perspective
 * Add a new SVN repository, URL: https://jython.svn.sourceforge.net/svnroot/jython
 * Select trunk/jython from the repository tree and Checkout the project using the New Project Wizard.
 *Set up source folders for the project
  *Access the properties of `<yourProjectName>` (Right-click on the project and select `Properties`)
  *Click on `Java Build Path` and select the `Source` tab
  *Leave only `<yourProjectName>/src` on the build path
  *Set the Default output folder to `<yourProjectName>/build` This means Ant won't have to rebuild the compiles Eclipse makes.
  *Click ok, and check for a few files that won't compile if you don't have the appropriate jars. Unless you're working on them you can just right click on those files, go to Build Path and exclude them.
   *org.python.util.Py``Servlet depends on the servlet api jar
   *org.python.util.Readline``Console depends on the java-readline jar
   *com.ziclix.python.sql.handler depends on various db jars so I just exclude that package altogether.
  *If you do not want to exclude files from being compiled, add the following `.jar` files to the java build path of your project:
   *ant.jar (from http://ant.apache.org/)
   *j2ee.jar (from http://java.sun.com/javaee/index.jsp)
   *ojdbc14.jar (from http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html, see also: http://forums.oracle.com/forums/ann.jspa?annID=201)
   *libreadline.jar (see also ReadlineSetup)
   *jline-0.9.91.jar (from http://jline.sourceforge.net/downloads.html)

== Building the project using ANT ==
[[Anchor(ANT)]]
At this point, you should be able to build the project using Eclipse's `Java Builder`. This will only compile the classes though --you'll want to use `<yourProjectName>/build.xml` to get the full ant build. (Jython won't run without this.) To do this, right click on build.xml and choose Run As Ant Build.

A successful build should output something like the following:
{{{
Buildfile: c:\workspace\JythonTip\jython\build.xml
init:
     [echo] --- Build environment for jython ---
     [echo] --- Flags (Note: If the {property name} is displayed,
     [echo] --- then the component is not present)
     [echo] --- Optional Libraries ---
     [echo] java2 coll = true
     [echo] servlet = ${servlet.present}
     [echo] readline = ${readline.present}
     [echo] oracle = ${oracle.present}
     [echo] informix = ${informix.present}
     [echo] mysql = ${mysql.present}
     [echo] postgresql = ${postgresql.present}
     [echo] jndi = true
     [echo] jdbc = true
     [echo] jdbc3.0 = true
dist-prepare:
prepare:
parser:
compile:
jar:
   [delete] Deleting: C:\workspace\JythonTip\jython\build\mainClass.mf
copy-xml:
copy-dist:
BUILD SUCCESSFUL
Total time: 2 seconds
}}}
Note that this sample was actually a re-build, so it didn't do that much (you'll see more output on the first build) and ran pretty fast (2 seconds). Also, note that I did not link in the optional "user-supply-able" jars. To do so, just add those entries to your ant.properties (look for the placeholders).

Also, you can specify the ant targets that you want to run using the `Targets` tab under `External Tools` dialog. For example, the `copy-dist` seems to run by default. To force a full build, check the `all` target.

And here is a [wiki:Self:/JythonDeveloperGuide#sampleBatch sample batch file (windows)] that runs the eclipse-built jython.jar If you set the default output directory to `build` in the Build Path setup, you can replace the jython.jar in your script with the path to `build`. That means after running the initial Ant build you can just rerun your Jython script and it will reflect the latest changes you've made to the java code.

ClarkUpdike, incept: 2005-02-10

Setting up the jython development environment in Eclipse

Eclipse has a plugin to become a SVN client and can be used to get the project from the repository. It takes a few steps to set it up, but seems to work well once you do. Please correct any mistakes. (Works for Eclipse 3.1-3.3)

Installing the Subclipse plugin

Checking out the Jython project

  • Switch to SVN Repository Exploring perspective
  • Add a new SVN repository, URL: https://jython.svn.sourceforge.net/svnroot/jython

  • Select trunk/jython from the repository tree and Checkout the project using the New Project Wizard.
  • Set up source folders for the project

Building the project using ANT

Anchor(ANT) At this point, you should be able to build the project using Eclipse's Java Builder. This will only compile the classes though --you'll want to use <yourProjectName>/build.xml to get the full ant build. (Jython won't run without this.) To do this, right click on build.xml and choose Run As Ant Build.

A successful build should output something like the following:

Buildfile: c:\workspace\JythonTip\jython\build.xml
init:
     [echo] --- Build environment for jython ---
     [echo] --- Flags (Note: If the {property name} is displayed,
     [echo] --- then the component is not present)
     [echo] --- Optional Libraries ---
     [echo] java2 coll  = true
     [echo] servlet     = ${servlet.present}
     [echo] readline    = ${readline.present}
     [echo] oracle      = ${oracle.present}
     [echo] informix    = ${informix.present}
     [echo] mysql       = ${mysql.present}
     [echo] postgresql  = ${postgresql.present}
     [echo] jndi        = true
     [echo] jdbc        = true
     [echo] jdbc3.0     = true
dist-prepare:
prepare:
parser:
compile:
jar:
   [delete] Deleting: C:\workspace\JythonTip\jython\build\mainClass.mf
copy-xml:
copy-dist:
BUILD SUCCESSFUL
Total time: 2 seconds

Note that this sample was actually a re-build, so it didn't do that much (you'll see more output on the first build) and ran pretty fast (2 seconds). Also, note that I did not link in the optional "user-supply-able" jars. To do so, just add those entries to your ant.properties (look for the placeholders).

Also, you can specify the ant targets that you want to run using the Targets tab under External Tools dialog. For example, the copy-dist seems to run by default. To force a full build, check the all target.

And here is a [wiki:/JythonDeveloperGuide sample batch file (windows)] that runs the eclipse-built jython.jar If you set the default output directory to build in the Build Path setup, you can replace the jython.jar in your script with the path to build. That means after running the initial Ant build you can just rerun your Jython script and it will reflect the latest changes you've made to the java code.

JythonDeveloperGuide/EclipseNotes (last edited 2012-06-03 22:23:41 by JeffAllen)