User Tools

Site Tools


en:developer:eclipse

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:developer:eclipse [2019/11/21 07:18] – [To Delete a Project] anupamaen:developer:eclipse [2023/03/13 01:46] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +
 +
 +
 ====== Eclipse and Greenstone 3 ====== ====== Eclipse and Greenstone 3 ======
  
Line 27: Line 30:
 =====Method 1===== =====Method 1=====
  
-====Loading the gs3 eclipse project file into Eclipse====+====A. Loading the gs3 eclipse project file into Eclipse====
  
 An Eclipse project file is part of the GS3 svn checkout. It consists of a .project file, with associated .classpath file. An Eclipse project file is part of the GS3 svn checkout. It consists of a .project file, with associated .classpath file.
Line 40: Line 43:
  
  
-====To achieve the same from scratch ====+====B. To achieve the same from scratch ====
  
 Creating an Eclipse project for Greenstone that can be reused with other fresh Greenstone checkouts from SVN. Creating an Eclipse project for Greenstone that can be reused with other fresh Greenstone checkouts from SVN.
  
-===Build Greenstone before opening Eclipse===+===1. Build Greenstone before opening Eclipse===
  
 In an x-term: In an x-term:
Line 57: Line 60:
   * run //makejar// in gli folder   * run //makejar// in gli folder
  
-===Setting up Eclipse===+===2. Setting up Eclipse===
  
   * Open Eclipse and go to Window > Open Perspective > Java Browsing   * Open Eclipse and go to Window > Open Perspective > Java Browsing
Line 68: Line 71:
     * In the Libraries tab, remove all jar files, so that only the "JRE System Library" remains. **Be patient, this step can take quite some time.** <del>In the Libraries tab, choose to remove both occurrences of LuceneWrapper.jar (since it's the LuceneWrapper3.jar files -- especially in gs2build/common-src -- that are the important ones). Also remove any occurrence of LuceneWrapper3.jar, since we've moved to using LuceneWrapper4.jar.</del>     * In the Libraries tab, remove all jar files, so that only the "JRE System Library" remains. **Be patient, this step can take quite some time.** <del>In the Libraries tab, choose to remove both occurrences of LuceneWrapper.jar (since it's the LuceneWrapper3.jar files -- especially in gs2build/common-src -- that are the important ones). Also remove any occurrence of LuceneWrapper3.jar, since we've moved to using LuceneWrapper4.jar.</del>
     * Press Add External Jars and **first** add in the following jar files from web/WEB-INF/lib (order matters, else you get a compile error that DigestUtils's sha hex function isn't found): <code>     * Press Add External Jars and **first** add in the following jar files from web/WEB-INF/lib (order matters, else you get a compile error that DigestUtils's sha hex function isn't found): <code>
-$GS3SRCHOME/web/WEB-INF/lib/ant.jar+$GS3SRCHOME/web/WEB-INF/lib/ant.jar (or [ANT DIRECTORY]/lib/ant.jar)
 $GS3SRCHOME/web/WEB-INF/lib/axis.jar $GS3SRCHOME/web/WEB-INF/lib/axis.jar
 $GS3SRCHOME/web/WEB-INF/lib/commons-codec-XXX.jar $GS3SRCHOME/web/WEB-INF/lib/commons-codec-XXX.jar
Line 88: Line 91:
 $GS3SRCHOME/web/WEB-INF/lib/recaptcha4j-XXX.jar $GS3SRCHOME/web/WEB-INF/lib/recaptcha4j-XXX.jar
 $GS3SRCHOME/web/WEB-INF/lib/serializer.jar $GS3SRCHOME/web/WEB-INF/lib/serializer.jar
-$GS3SRCHOME/web/WEB-INF/lib/slf4j-api-1.6.6.jar +$GS3SRCHOME/web/WEB-INF/lib/slf4j-api-1.6.6.jar   * 
-$GS3SRCHOME/web/WEB-INF/lib/slf4j-jdk14-1.6.6.jar +$GS3SRCHOME/web/WEB-INF/lib/slf4j-jdk14-1.6.6.jar * 
-$GS3SRCHOME/web/WEB-INF/lib/solr-core-4.7.2.jar +$GS3SRCHOME/web/WEB-INF/lib/solr-core-4.7.2.jar   * 
-$GS3SRCHOME/web/WEB-INF/lib/solr-solrj-4.7.2.jar+$GS3SRCHOME/web/WEB-INF/lib/solr-solrj-4.7.2.jar  *
 $GS3SRCHOME/web/WEB-INF/lib/xalan.jar $GS3SRCHOME/web/WEB-INF/lib/xalan.jar
 $GS3SRCHOME/web/WEB-INF/lib/xercesImpl.jar $GS3SRCHOME/web/WEB-INF/lib/xercesImpl.jar
 $GS3SRCHOME/web/WEB-INF/lib/xml-apis.jar $GS3SRCHOME/web/WEB-INF/lib/xml-apis.jar
 $GS3SRCHOME/web/WEB-INF/lib/xsltc.jar $GS3SRCHOME/web/WEB-INF/lib/xsltc.jar
-</code>\\ The 2 slf4j*.jar files and 2 solr*.jar files are for compiling what's in ext/solr/src/java.\\  Also add in:\\ <code>+</code>\\ *The 2 slf4j*.jar files and 2 solr*.jar files are for compiling what's in ext/solr/src/java.\\  Next, also add in:\\ <code>
 $GS3SRCHOME/lib/java/svnkit.jar $GS3SRCHOME/lib/java/svnkit.jar
 $GS3SRCHOME/lib/jni/mg.jar $GS3SRCHOME/lib/jni/mg.jar
Line 123: Line 126:
 =====Method 2===== =====Method 2=====
  
-  Firstly you will need to create a new empty project in Eclipse by clicking ''File -> New -> Java Project'' +  Firstly you will need to create a new empty project in Eclipse by clicking ''File -> New -> Java Project'' 
-  Give it a sensible name and then click **Finish**. +  Give it a sensible name and then click **Finish**. 
-  Go to Window > Perspective > Open Perspective > Java. This is the Java editing view. +  Go to Window > Perspective > Open Perspective > Java. This is the Java editing view. 
-  Open up the Eclipse's project in the **Package Explorer** and right-click on the ''src'' folder and choose **Import**. +  Open up the Eclipse's project in the **Package Explorer** and **right-click on the ''src'' folder** and then choose **Import**. 
-  In the next dialog choose ''General -> File System''. Press Next. +  In the next dialog choose ''General -> File System''. Press Next. 
-  Click the top Browse button, find and click on your ''$GS3SRCHOME/src/java'' folder and press OK. +  Click the top Browse button, find and click on your ''$GS3SRCHOME/src/java'' folder and press OK. 
-  * If you want to edit and compile GLI and/or the solr extension code, add ''$GS3SRCHOME/gli/src'' and ''$GS3SRCHOME/ext/solr/src/java'' as source folders too. +  Click the checkbox next to the ''java'' folder so that it is checked. 
-  * Click the checkbox next to the ''java'' folder so that it is checked. +  Click the **Filter Types** button and check the ''*.java'' option and press OK. 
-  Click the **Filter Types** button and check the ''*.java'' option and press OK. +  Click the **Advanced button** and check the **Create links in workspace** checkbox (and make sure the two checkboxes below it are also checked). 
-  Click the **Advanced button** and check the **Create links in workspace** checkbox (and make sure the two checkboxes below it are also checked). +  Click **Finish**.
-  Click **Finish**.+
  
-In order fix all the errors and allow the project to build correctly you will also need to complete the following steps.+  * **Warning:** Additionally adding the gli source code in the way described next will result in "Access restriction" compilation errors that I've not resolved yet. I've only successfully worked with GS3's src/java folder in Eclipse using Method 2.\\ If you want to edit and compile GLI and/or the solr extension code, add ''$GS3SRCHOME/gli/src'' and ''$GS3SRCHOME/ext/solr/src/java'' as src folders too, then right-click on the Eclipse project folder in the Package Explorer > New > Source Folder. Give it a name like ''glisrc'' or ''solrsrc''.\\ Next, rightclick on this new source folder (e.g. ''glisrc'') and then choose Import. Then repeat steps 5-10 for each new code src folder to add.\\ If you forget to create a new source folder then beware that in Eclipse's package view, all the code for gli/src and ext/solr/src/java get merged into the org.greenstone.* tree of GS3's src/java if they're in the ''org.greenstone'' package.
  
 +  * Go to Project > Clean to clean the compile products. Then set Project > Build Automatically. In order fix all the compile errors and allow the project to build correctly, and in an output folder of your choosing, you will also need to complete the following steps.
   * Right-click on the project folder and choose Build Path > Configure Build Path. Alternatively, right click on the Project folder and choose Properties > Java Build Path.   * Right-click on the project folder and choose Build Path > Configure Build Path. Alternatively, right click on the Project folder and choose Properties > Java Build Path.
 +  * Go to the Source tab and at the bottom set the ''Default output folder'' to ''$GS3SRCHOME/web/WEB-INF/classes''.
   * On the Libraries tab use the 'Add External JARs' button to add the following .jar files:   * On the Libraries tab use the 'Add External JARs' button to add the following .jar files:
 <code> <code>
Line 218: Line 222:
   * There are some [[en:developer:eclipse_shortcuts|useful Eclipse shortcuts]] available on the wiki.    * There are some [[en:developer:eclipse_shortcuts|useful Eclipse shortcuts]] available on the wiki. 
   * For a **walkthrough with screen shots** of the steps involved in installing Greenstone 3 by using the Eclipse plugin Subclipse (for checking out Greenstone 3 code from SVN), see [[http://www.cs.waikato.ac.nz/~ak19/eclipse_project_of_GS3_from_SVN.html|Eclipse project of Greenstone 3 code using Subclipse]]. **NOTE:** I suggest that you do not bookmark that link, because it is likely to change in the future. This page will host the correct link to wherever that document may be found in future. Therefore, bookmark this page instead.   * For a **walkthrough with screen shots** of the steps involved in installing Greenstone 3 by using the Eclipse plugin Subclipse (for checking out Greenstone 3 code from SVN), see [[http://www.cs.waikato.ac.nz/~ak19/eclipse_project_of_GS3_from_SVN.html|Eclipse project of Greenstone 3 code using Subclipse]]. **NOTE:** I suggest that you do not bookmark that link, because it is likely to change in the future. This page will host the correct link to wherever that document may be found in future. Therefore, bookmark this page instead.
- 
  
en/developer/eclipse.1574320680.txt.gz · Last modified: 2019/11/21 07:18 (external edit)