Creating a KFS project in Eclipse
- Former user (Deleted)
- Kathleen Avery (Deactivated)
- Benjamin Daniels
Prerequisites:
You will need the following items to complete these instructions:
Each of the following should be installed on your local system prior to installation of Eclipse.
- Java 1.8 (PC users may require Unlimited Strength Cryptography Extension)
- Tomcat 8.5 with JDK 1.8
Database Tunneling Software MIT Kerberos Ticket Manager (PuTTY for Windows)- SourceTree (https://www.sourcetreeapp.com/)
- Git (https://git-scm.com/download/win)
- Maven (https://maven.apache.org/download.cgi)
AntAccess to the Rice jar files that are the correct version for the version of the KFS project you are creating.Oracle driver jar file (Once Tomcat directory is in place, copy ojdbc8.jar from kfs/build/drivers to your {tomcat install}/lib directory
1. Download Eclipse
Download and install the Eclipse IDE for Java EE Developers. Since the KFS software relies heavily on Spring, the recommended IDE is Spring STS (https://spring.io/tools, version 4.2.3)
After installing, start the Eclipse application.
The Select a Workspace dialog will appear. Enter your location where you want to store your Eclipse projects and click OK.
2. Configure Eclipse
Disable automatic building.
You may wish to turn off automatic building of the project as it can consume resources when you need them for other things. Select Project->Build Automatically from the Eclipse menu. Ensure that it is unchecked. Once you have the project completely up and running, you should re-enable this feature.
Install the formatting rules into your project.
Download this eclipse format file: eclipse_format.xml and save it to your local disk.
Right-click on your project in the Project Explorer tab and select Properties.
Click Java Code Style->Formatter, then click the Import button and choose eclipse_format.xml file at the location where you saved it. Click Open.
Click Apply, then OK.
Select the Java 1.8 JRE within Workspace -> Preferenes -> Java -> Installed JREs
Note: Your JDK installation directory may be different than the screenshot:
Also set your compiler JDK compliance to 1.8:
Suspend Validation
While setting up the workspace, suspending validation will improve setup time. The Kuali xml and jsp files tend to throw validation errors based on default eclipse settings. Once your workspace is running, you can resume validation if you wish.
3. Download KFS and RICE from the GIT repository
Build GIT repository location
Create directory in your $$Home directory (like Git_Repo)
Navigate to the directory, using your terminal window.
cd (name of newly created directory, like Git_Repo above)
Execute Git clone commands, one at a time.
git clone https://netid@stash.uconn.edu/scm/kfs/kfs5.git
git clone https://netid@stash.uconn.edu/scm/kfs/rice219embedded.git
git clone https://netid@stash.uconn.edu/scm/kfs/dbscripts-test.git
git clone https://netid@stash.uconn.edu/scm/kfs/dbscripts.git
If you are using KFS with Maven, then you will want to clone the appropriate Kuali KFS repository.
- Clone the repository
git clone https://github.com/KualiCo/financials.git - Change to the directory with your financials repository.
- Switch to the appropriate branch or tag. As of this writing, we will be using the kfs-6.0.0 tag
git checkout tags/kfs-6.0.0 - Your kfs financials repository should now be pointing to the appropriate code-base used with uconn kfs.
Import your projects
Use File-> Import and select Existing Maven Projects.
Navigate to the root directory for your repositories. In this example, it will be c:\projects\gitrepos
Import in this order:
- /kfs5/pom.xml
Once the project imports and compiles, disable the maven workspace resolution. This will force the project to use maven artifacts rather than those within the workspace. This will come into play once we import the Kuali Financials projects.
Right-click on kfs-war -> Maven -> Disable Workspace Resolution - financials/pom.xml and all sub poms - this is the source code from Kuali Kfs.
- rice219embedded
After everything has been imported, this is what your Package Explorer would look like in Eclipse:
kfs-war is the uconn kfs code.
In Eclipse, click on Window+Perspective+open Perspective+Other
Choose Git
click OK
Choose the create new local Git icon
Click Browse, to search for your Git directory
Choose your directory and click OK
Click Finish
You will see your project in the Git Repositories Tab.
Highlight your project
Right click on the project and select import projects.
click Finish
Click the Java button to switch to the Java perspective.
You will see the project in the Project Explorer window of the Java perspective.
4. Configure your KFS project
TBD Once Property file's are created and structured.
Initial build of KFS 5.
KFS 5.x contains the Rice war file. Before the first time you run dist-local (ant target), because you do not have a build/rice-lib directory, the ant script expands the war file and extracts the dependent rice jar files and copies them to build/rice-lib. The ant script also generates the .classpath file that contains the Eclipse build path data. Follow this procedure upon initial creation of the KFS project:
Create your local kfs-build.properties file.
Copy build/external/user/kfs-build.properties from another developer to your $HOME directory.
By default on Windows 7 and higher this is C:/Users/<username> and on Mac OS X it is /Users/<username>
- Edit your $HOME/kfs-build.properties to customize it to match your local settings.
TODO: Describe necessary changes to kfs-build.properties
- Create $HOME/Source directory. Obtain a zip file from another developer.
- Run dist-local (see Step 7: Deploy Code to Server) to extract the rice jar files and create the build path.
- Right-click on the project and select Build Project.
- Run dist-local once more.
Create your local log4j.properties file.
Copy build.external/log4j.properties file to your $HOME directory and edit it as necessary.
5. Add Tomcat Server
The steps are the same for adding a Tomcat 6 or 7 server. The screenshots shown are for Tomcat 7.
Open the Server view by clicking on Window->Show View->Other then select Server from the Show View dialog and click OK.
The Servers tab will appear in the bottom window of Eclipse. Right-click and select New->Server.
In the New Server dialog, select Tomcat 7 and click Next.
Browse to the location where you have installed your Tomcat 7 server and then click Finish.
In the Servers tab, double click the Tomcat v7.0 server to open the Server information screen.
Make the following changes to the Server properties:
Right-click on the new server and select Properties.
We can use the defaults for most of the general configuration except the Timeouts. Sometimes the server can take longer to start so we will enter a large # of seconds:
Open the launch configuration so we can adjust the JVM arguments:
Click on the Arguments tab and add the following arguments to the end of the VM arguments field:
- -Xms128m -Xmx1024m
- -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true
- -Dadditional.kfs.config.locations="/{directory of configuration files}/configuration.properties"
The configuration.properties will be explained in the "Configure your KFS Project " section.
Click Apply and then OK.
Save and close the Tomcat window.
Change your context root
Right-click on your kfs-war project and select Properties. Change the context root to kfs-dev
- Use Tomcat installation (takes control of Tomcat installation)
- Serve modules without publishing
- Never publish automatically
- Set both timeouts to 300 seconds
Click open launch configuration to open the Edit launch configuration properties.
Click on the Arguments tab and add the following arguments to the end of the VM arguments field:
- -Xmx512m -XX:MaxPermSize=256m
- -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true
Click Apply and then OK.
Save and close the Tomcat window.
6. Deploy Code to Server
Right-Click on Server and Pick "Add and Remove"
You should see your kfs-war project listed. Click Add to move it to the Configured Column. Click Finish.
Now, the server will need publishing, Right-click the server and pick Publish. Since it's the first publish, it may take a while.
Once published, make sure that the context root for the kfs project is set as kfs-dev. Open the server properties again and click the Modules tab at the bottom. Click the 'edit' button for our kfs-war project and set the path to /kfs-dev.
Click OK and then save the configuration. At this time you will also want to re-publish the server but it should be a lot quicker.
Click Window->Show View->Ant to open the Ant view.
Right-click in the Ant window and select Add Buildfiles...
Expand your KFS project and select the build.xml file.
In the Ant view, expand the kfs project and double-click the dist-local target.
This will run the ant dist-local target and deploy your code to the Tomcat server. Output messages from ant will display in your Console window. You should see a message similar to the following in your Console window. Of course the path will be the path where you have installed Tomcat locally.
[copy] Copying 1 file to /kuali/servers/apache-tomcat-6.0.37/conf/Catalina/localhost
7. Start the Server
The KFS application should now be built and deployed to the Tomcat server.
Before starting the KFS application, you will need to have a tunnel created to the database server.
Refer to this link for instructions on setting up a tunnel to the database:
In the Servers tab, highlight the Tomcat 7 server, and click the Run button (the triangle with a green circle around it). The Console will display messages written during startup of the application.
Now, open your browser and go to the URL http://localhost:8080/kfs-dev.