Build and Run Spring Boot and React web application on Kali Linux without any IDE. Only using command line with Maven and NPM.

Shihara Dilshan
3 min readFeb 17, 2021

Hello everyone,

This is my very first medium article. I hope this article will help you to learn something new. So without further talk let’s get started.

First let’s talk about the Spring Boot part. In traditional approach we normally use an IDE(integrated development environment) like IntelliJ IDEA, vs-code, etc… to develop and build Spring boot application. So by clicking just a one button we get our application up and running on specific port. Like a magic the application get started right?

But that is not the case… There are lot of things going on the behind the scene. When we initialize a Spring Boot application we choose a build automation tool like Maven or Gradle.

This is the magic man who build your project for you. In this example I am going to use Maven as build tool for our application. You will need Java installed in your machine(In Kali Linux Java is pre-installed), and Maven.

To install Maven : https://maven.apache.org/install.html

After installing Java and Maven you are good to go. So What we are going to do is first we are going to create jar file which it’s like package which contain class file your various dependencies and configuration files using Maven. Which execute by single stuff. Then we are going to run that Jar file using Java.

So let’s create the Jar file. Add these build plugins to the pom.xml

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>com.example.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

In this case we add Maven build plugin to our pom.xml file and ignoring the test case failures in our application. Otherwise we will get some errors during the build. Now everything is good to go. Let;s create the jar file. Type the following command on terminal.

mvn clean install

This will create the jar file inside the target folder.

Now go the target folder and execute the following command. It will start your Spring Boot application on the specific port. (The default port is 8080).

java -jar rw-0.0.1-SNAPSHOT.jar

That is all about the spring boot application. You successfully started Spring boot application without any IDE. Only using command line with Maven.

Now let’s move into our font end part of the application. To create a react app you must have nodejs and npm(or yarn) installed in your system. In this example I am going to use npm.

To install nodejs and npm : https://nodejs.org/en/download/

Let’s create a react project.

npx create-react-app my-app 

This will take few minutes to create the react project and download the necessary node_modules for the project. After finishing the above process go into the project’s folder where package.json file is located and type the following command.

npm start

This will start react application on port 3000.

That’s it. You have successfully start a full stack web application with react and spring boot without help of any IDE.

--

--

Shihara Dilshan

Associate Technical Lead At Surge Global | React | React Native | Flutter | NodeJS | AWS | Type Script | Java Script | Dart | Go