Visual Studio Code

This section outlines how to set up the application in Visual Studio Code. It uses the project default Payara Server. The project also has Maven profiles to support GlassFish and Open Liberty. GlassFish or Open Liberty can be very similarly used with Visual Studio Code.

Prerequisites

  • Java SE 11 or Java SE 17 is required. Please make sure that you have properly set up the JAVA_HOME environment variable.

  • Payara Server 6 is required. You can download Payara Server 6 from here.

  • Visual Studio Code is required. You can download Visual Studio Code from here.

  • Ensure that the Visual Studio Code Extension Pack for Java is installed.

Download

Download the source code zip file and expand it somewhere in your file system. Note that this is a Maven project.

Visual Studio Code Setup

Start Visual Studio Code. Go to → Extensions (Ctrl+Shift+X). Search for Payara Tools. Install Payara Tools.

vs add payara tools

Once the Payara Tools plugin is installed, click on the Payara icon on the left side bar below the Extensions icon, then click on the '+' icon on the Servers. Choose 'Local Domain' → 'Browse the Payara Server', then select the directory where you installed Payara 6.

vs add payara 1
vs add payara 2

Name the instance Payara 6 and hit next. Select the default domain1.

vs add payara 3
vs add payara 4

Now you will see the instance under Servers. Right-click on the instance and select 'Start'. Once Payara starts, you can verify it is up by visiting http://localhost:8080.

vs run payara

Running the Application

You will now need to get the application into Visual Studio Code. Go to File → Open Folder → Select the root directory of the Cargo Tracker project in your file system, and hit finish. Visual Studio Code will automatically identify it as a Maven project. It will take a few minutes to import the project for the first time.

vs import

After the project loads, go to the Maven tab on the left bottom side. You will see that Eclipse Cargo Tracker is a recognized Maven project. Right click on it and run the 'clean' Maven command. Finally, run the 'package' Maven command. It will take a while the very first time as Maven downloads dependencies.

vs build

After this, a war file named 'cargo-tracker.war' will be built under the 'target' directory. Right-click on the war file and select the 'Run on Payara Server' option.

vs deploy

The first time start up might take a bit of time. Once the deployment is done, Visual Studio Code will automatically open up a default browser window with the application.

vs sucess

There is a tracking interface to track the current status of cargo and a booking interface to book and route cargo. You should explore both interfaces before diving into the code. You should also check out the REST and file processing interfaces to register handling events as well as the mobile web interface. You can test against the REST interfaces using our soapUI tests.

Once you are done, click on the 'x' icon on the Payara server instance to stop the Cargo Tracker application.