Compiling TrackStudio from source code

For the purpose of compiling TrackStudio, you will need Java SDK and Apache Ant. It would be even better if you have some IDE, but for minor changes even a simple text editor will be sufficient.

How to compile the project without using IDE

Make sure that Ant is installed correctly. For this, in the command line or terminal you have to type

ant

The response must look like:

Buildfile: build.xml does not exist!
Build failed

In case Ant is not installed properly, you need to refer to documentation.

  1. Download the source code of TrackStudio.
  2. Extract the source code of TrackStudio to any empty folder.
  3. In the command line, type ‘ant war’.
  4. Wait for installation to complete.
  5. After successful compilation, file TrackStudio.war must appear in the folder dist.This file can be extracted to the directory webapps/TrackStudio of your backup instance of TrackStudio.
  6. Thereafter, you can launch the backup instance and see what you have got.

How to create and compile the project in IntelliJ IDEA.

  1. Download the source code of TrackStudio.
  2. Extract the source code of TrackStudio to any empty folder.
  3. Run IDEA.
  4. Create a new project, while indicating the folder, where you extracted the archive with source code, as its root folder.




  5. Go to the menu item File->Project Structure.
  6. Select the tab Libraries.
  7. Create the library TrackStudio.
  8. Add all the classes from folder webapps/TrackStudio/WEB-INF/lib to it.
  9. Then open the tab Ant Build (generally it is located on the right side in the IDEA window)
  10. Select the file build.xml from folder, where you had extracted source codes of TrackStudio.
  11. Run the task named ‘war’ from the tasks list Ant Build
  12. After successful compilation, file TrackStudio.war must appear in the folder dist. This file can be extracted to the directory webapps/TrackStudio of your backup instance of TrackStudio.
  13. Thereafter, you can run the backup instance and see what you have got.

This way, in TrackStudio you can practically change anything, or complete your own packages and plugins.

How to remove syntax error highlights



So as to make the editing of our code easy in IDEA, it needs to be integrated well with the features of our project.
As a first step, connect the library javax.servlet.jar. It is located in the folder jetty/lib of extracted source code.

  1. In IDEA, go to the menu item File->Project Structure.
  2. Select the item Modules.
  3. Select the module TrackStudio.
  4. Select the tab Dependencies.
  5. Press the button Add and select Single Module Library
  6. Locate javax.servelet.jar and add it to the project

After that the source code will look like:

Now it is time for libraries with tags.
We need to create Facet for our project. For this purpose:

  1. In IDEA, go to the menu item File->Project Structure.
  2. Select the item Facets.
  3. Select Web.
  4. Add new facet to the module TrackStudio
  5. Indicate the path to the file web.xml: webapps/TrackStudio/WEB-INF/web.xmloretc/webxml/web.jspc20.xml
  6. Specify the path to resources (Web Resource Directory Path): webapps/TrackStudio/F
  7. Indicate the Relative Path as /

Debugging

For debugging of code, Remote Debug can be configured. And for this purpose:

  1. In IDEA, go to the menu item Run->Edit Configuration.
  2. Create a new configuration. Select the item Remote.
  3. Connect the files of source code from the module TrackStudio.
  4. Copy the string into the file startJetty.vmoptions in the root of your backup instance of TrackStudio.
  5. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

  6. Run jetty
  7. sh startJetty
  8. Following line must appear in the terminal
  9. Listening for transport dt_socket at address: 5005
  10. Go to IDEA.
  11. Select the earlier created configuration of TrackStudio and press the button for debugging.
  12. Put the breakpoints at the required places.
  13. Through the browser, enter TrackStudio and execute the functions, which must stop debugger at the required points.
  14. Locate the bug.
  15. Correct the error.
  16. Stop the backup instance of TrackStudio.
  17. Recompile your source code as per the above mentioned instruction.
  18. Repeat until all errors are fixed