learn program
learn program

Reputation: 93

how can i deploy the jar file in remote server

In my local machine, i just running the java application in eclipse and working perfectly.

But in my staging machine, i have a spring boot application and running in the centos server, which i am accessing by putty

when i tried running the command

> mvn clean package -DskipTests

after the above step, what the next step, i need to do

Actually i did was,

nohup java -jar target/cs.jar &

so that, jar was created in the target folder. Then when i tried to hit the endpoint from the postman its not working

Upvotes: 0

Views: 7445

Answers (1)

Anjan Dash
Anjan Dash

Reputation: 194

As you said there might be some internet issue on the Staging Server. Maven may try to get dependencies from internet, but since it is not able to get to internet it is hanging.

Can you try to use following command on your linux server

$wget http://www.google.com 

if it works correctly then you know that internet is there on that machine. Your maven should work then .

If not then, I would suggest build the whole thing on your local and transfer the build files to the server. In the server you can just execute

$ java -jar target/myproject-0.0.1-SNAPSHOT.jar

I am assuming that you can package the whole application in a jar file. To move the jar file from windows machine to server machine you can use winscp tool.

Upvotes: 2

Related Questions