== Instructions - How to Start with Development == The application and it's build process is OK with GNU/Linux, Microsoft Windows and other operating systems. == Setting up Java Development Kit (JDK) == The application is coded in the Java programming language, so you will need the tools that are part of a recent JDK. The recommended IDE is Eclipse, which also uses Java. If you want you can run Eclipse in one version of Java, and compile and run the application with another version of Java, but it is not necessary. ==== Installation ==== The application has been tested with: * Open JDK 7 * Oracle JDK 8 (http://www.oracle.com/technetwork/java/javase/downloads/index.html). We recommend going the 8 route due to planned upgrades of the code base in the near future. So, download the JDK version that you prefer and install it. NOTE: Check if you already have some other Java or JDK versions. If you use built-in packages and package managers in some operating systems, the JDK version might be old, and if you try to install a new version alongside an old one, you might get a conflict when using the default installation options. If you don't need both versions, uninstall the old one before installing the new one. If you do need both version, install the new one in a different path. It is possible to switch between the two afterwards. ==== Configuring in Windows ==== * Set up system variable JAVA_HOME to the absolute path to the main directory where you installed the JDK * Set up system variable PATH to the absolute path of the bin directory inside the JDK or %JAVA_HOME%\bin * For 64-bit operating systems, both 64-bit and 32-bit JDK versions should be installed [[Image(1.jpg)]] * Check installation in command shell {{{ javac -version }}} you should get the version of the installed java compiler ---- === 2. Download and setup Eclipse - Download Eclipse (for Java Developers is enough as a basic installation, but Eclipse Java EE is recommended because the packages for Web Development (WTP) are preinstalled. - Best to download a ZIP version and just unpack it in folder of your choice ==== Ubuntu - before running Eclipse open the eclipse.ini in a text editor with administrative privileges: {{{ sudo nano /usr/lib/eclipse/eclipse.ini }}} and add this as a last line (do not modify the rest): {{{ -Djava.library.path=/usr/lib/jni }}} then Eclipse will start without problems. ---- Run Eclipse === 3. Install the m2eclipse and subclipse plugins Install the m2eclipse plugin from the following update address - [http://m2eclipse.sonatype.org/sites/m2e] (In Eclipse -> Help -> Install New Software , you will add the address and available packages will showup, please add everything becides AJDT and WTP that depend on other plugins) Note: New version of Eclipse Java and Java EE include a Maven plugin, so it is not necessary to install it. In the same way, install the Subclipse plugin from the following update address - [http://subclipse.tigris.org/update_1.6.x] === 4. Download the project source code and setup a project === Change the Eclipse IDE perspective to SVN Repository and create a new project with the option Checkout as maven project, from the address http://develop.ii.edu.mk/svn/isii Maven is supposed to download all necessary files needed to run the application that are listed in the pom.xml (this might actually take very very long depending on the internet connection speed ). '''Note:'''If you use Ubuntu, when you choose a plugin, by marking it at the relevant check box, the Next button of the wizard might stay disabled. If this happens, just press ENTER (with the plugin installation window in focus). '''Eclipse setup''' - In Eclipse open Window -> Preferences -> Java -> Installed JREs Delete the old record and add a new one that points to the JDK (and not JRE) as in the image [[Image(2.jpg)]] - After this create a Shortcut to Eclipse.exe anywhere you like, right click the shortcut, and in the Target textbox add: ''-vm "C:\Program Files (x86)\Java\jdk1.6.0_16\bin"'' This is supposed to be the path to the JDK/bin folder. (on 64-bit operating systems the path in the –VM argument should point to a 32-bit JDK) With these two steps Eclipse will start and won't show a maven related warning. For a linux installation everything is the same just a different path. Before running or building the project, several local parameters should be set. This is done via a standard way of maven profiles, so you should open/create a file named '''settings.xml''' in the '''.m2''' directory in your main OS user profile directory. If you don't know where this is - check Eclipse preferences - maven - user settings. Sample maven settings.xml file: {{{ develop env develop ??????? ???????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? }}} You can create several profiles in this file, with different id and activation parameters, so that you can use choose the one you want on running the application, or packaging for deployment. Contact the developer team for parameter values for the development test servers. Otherwise install PostgreSQL, setup a username, password and create a UTF-8 database, and set the '''hbm2ddlauto''' parameter to '''update''', and the database schema structure will be automatically created. With hbm2ddlauto=update used, enables updates to the database schema structure when the Java source code of the Entities changes, otherwise the default value of this parameter is '''validate'''. More precisely this parameter designates that the database will be scanned and if the source code has structural changes, such changes will be automatically implemented in the database schema. This should be only used by intenet and it should not be left as default as unwanted changes could be commited to the database by mistake without a warning. So set this to update only when you are about to make database structure changes and then change it back to validate, which only checks that the source and the schema correspond. If you use another database system then hibernate.dialect should be changed, '''but this is not tested'''. '''CAS (CENTRAL AUTHENTICATION SERVICE)''' If you already have a CAS server, change the paths in the settings.xml file. If you need a test CAS server, follow the procedure. - Download any of the 3.5.x CAS versions from [http://downloads.jasig.org/cas/] and unpack it. - Find the file named CAS-server-webapp-versionnumber.war and copy it to the main folder of the Eclipse project and rename it to cas.war This will enable a test login to the system, whereas the username is anything you need, and the password is the same as the username. '''Start the application from Eclipse'''[[BR]] Run -> Run Configurations , then in the maven section right click then New, use any Name you like (for example '''start dossier'''), Base Directory -> ${workspace_loc:/projectname} , Goals -> '''clean jetty:run''' In the parameter add one with the name of '''env''', and value of '''develop'''. Repeat this again all the same but with a Name '''stop app''' and Goals '''jetty:stop''' It should look like this:[[BR]] [[Image(10.jpg)]] Click on Run and the application will begin to build. Note that on the first run, Maven will try to download all required libraries for development from the Internet and setup the library paths for all dependencies. This can take a very long time if your connection is not fast. On subsequent runs, this will not happed, but Maven tries to check for changes. If you want to speed up the process, after everything has been run without problems at least once, you should check the parameter '''Offline''' in the Maven parameters for that run configuration. The system listens on port 8081 (Jetty on 8081) http://localhost:8081/ '''Note:''' - in log4j.properties in the application folder src/main/resources one should change the line log4j.appender.R.File=/upisi.log or log4j.appender.R.File=/home/username/upisi.log or a location where the user running eclipse has write permission and where the logs should reside. [[wiki:WikiStart Back]]