Deploy a Spring app (JAR) for browser - angularjs

I have no knowledge about deployment, production server, web server, etc. But I have a web application and my boss wants to deploy it in order to access it by web browser.
So, my application was generated by Spring Initializr.
It's using Spring (Boot, Security, Web, Data JPA), with web service REST (#RestController), HTML templates and AngularJS.
With mvn clean package, I generated a JAR file of this application. It is working on my desk. But, how can I deploy it?
I believe that my company has an OVH hosting. Can I install JBOSS or Tomcat on it, and upload my JAR on OVH?

You can deploy your application on Tomcat but you need to have a war instead of a jar to run it on an existing application server.
You can read the following documentation to create the war : http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging
Once done, you just have to upload it on the server in the webapps directory of your tomcat server.

Related

Developping an angularJS app using a tomcat server

Hi stackoverflow community,
I'm on a project that imposes developping a web app with these technologies:
AngularJs app calling the back-end (the back-end API already existing)
this app will be hosted on Tomcat, with maven as a build tool.
Now I installed eclipse, configured maven and tomcat on it, and i want to start with my first html page. The problem is that I can't find how to deploy an html page (as a start) with these technologies without using a servlet.
I want to generate a war file using maven that would be deployed in tomcat server without defining servlets in web.xml.
All i can find on the internet is how to manually deploy angularJs apps on tomcat.
I found this github project that might be very useful, I'll try to follow the same project structure.

Hosting Angularjs 1.x application in tomcat server

How to host angular1 application tomcat server . I have developed one website in angularjs 1.x and want to host that on VPS server purchased from godaddy .
If your angularjs build is working properly you should have something like a "dist" folder with your complete app inside.
Enter that directory and create your .war file with:
$ jar -cvf theNameOfYourApp.war *
This will create a .war file that you can deploy on your tomcat server.

Deploy local angularjs application to webserver

Hi all i have completed my webapplication using angularjs, In local iam using tomact server in eclipse and it is working fine, Now i want to deploy my application to webserver what is the process to do it.
For ex : my local url is : http://localhost:8080/Hms/#/
i want to the url as http://www.hms.com
Please help me i am new in angularjs
If your angular web application depends on Tomcat server;
If you haven't own server for web hosting which has http ://www.hms.com, your hosting provider should provide Tomcat feature.
If you have own server for web hosting which has http ://www.hms.com, just copy paste your all files in your project folder e.g. $TOMCAT_PATH/webapps/your-project-root/. And redirect http ://www.hms.com to Tomcat port (default is 8080)
If you are using only AngularJs, it shouldn't depend on Tomcat. You can use angular boilerplate https://github.com/adilkaraoz/ngbp. Github link provides information in details. With ngbp, just copy build folder inside into the your web hosting and at the and you have http //www.hms.com url which include your web files.
You can deploy this project same as how you are deploying other web applications in tomcat. Hope you build a war file and deploy them.
Angularjs is a javascript framework as Jquery. For server it's javascript, which will be served back to the client as other js files.
Please refer how deployments are done tomcat. Just fyr, https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html
Thanks.

How to deploy AngularJS app and Spring Restful API service on the same domain/server?

I'm new to Spring and AngularJS. I followed the steps here to build the back end restful API, and it sends Json upon requests. So, according to the guide, When I run "mvn spring-boot:run" the tomcat server starts at localhost:8080.
Then I used Yeoman angular generator to build my angular app. And when I run "grunt serve" inside my angular app, the front end app runs at localhost:9000.
What should I do so that my angular app can be served together with my Springboot tomcat server on the same domain, say, localhost:8080 ?
Is there a sample project that I can follow? I found the following projects, but still cannot make it work as I don't have much background on tomcat.
https://github.com/robharrop/spring-angularjs
https://github.com/GermanoGiudici/angularjs-maven-tomcat-seed
https://github.com/xvitcoder/spring-mvc-angularjs
You need to take either:
the built files (grunt build then basically everything in the dist/ directory)
the raw files (your index.html and all JS as-is)
and copy them into one of the following folders (I recommend /public/): http://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
Spring Boot will automatically add static web resources located within any of the following directories:
/META-INF/resources/
/resources/
/static/
/public/
This means that not only does Spring Boot offer a simple approach to building Java or Groovy apps, you can also use it to easily deploy client-side JavaScript code and test it within a real web server environment!
This is going to be a pain for development however since you will have to re-copy the files every time you make a change for the front end. For production your goal should be to deploy a versioned copy of the built files with your spring app.
For development you might want to consider letting grunt serve the Angular content and running both Tomcat and your grunt server (is it node?) and enabling cross origin requests between your front end and back end. OR you could just copy the whole angular directory into one of the above directories but that is a short term approach.

rename the cobertura.ser file in tomcat/bin when i deployed my web application in tomcat

i deploed my web application instrumented with cobertura through war file in tomcat 6,it works well!
In th path tomcat/bin i found d:/dev/../module1/target/cobertura/cobertura.ser,normal according me.
Now i want know,how can i rename this file(d:/dev/../module1/target/cobertura/cobertura.ser) to cobertura.ser automatically when i deploy the web application
PS:my web app is multi modules web app.
thanks for answers!

Resources