java angular2集成,将Angular2项目集成到Tomcat服务器中

I've developed a Spring maven rest api for my project. For the client side, I'm using Angular2 with typescript. As new to Angular, referred angular website for the development, using npm and lite-server.

Now I need to make these two separate projects into a single project, by integrating the html,js,css files into my maven project, to deploy it in Tomcat server.

Project structure

Client side

Project

|__ app

|_ all app files

|__ node_modules

|__ typings

|__ index.html

|__ package.json

|__ style.css

|__ systemjs.config.js

|__ tsconfig.json

|__ typings.json

Server side

Project

|__ src/main

|__ java

|__ resources

|__ webapp

|__index.html

|__ pom.xml

All similar posts/blogs, i found suggest to update pom.xml with node etc. But what i need is,

Compile the angular-typescript project to js files.

Produce a set of fully functional html,js,css files.

Copy them to server webapp folder or whereever they must be.

Running Spring maven project in Tomcat must display my client side index page

Client must work (communicating with rest api) same way when they were two separate projects

How this can be done?

Run this command, npm run build, in angular project root folder to create a dist folder, containing production ready client side files. But got this error

missing script build

.

解决方案

At last used angular-cli. ng build --prod creates a production ready build. Copied index.html and .js files under project folder in tomcat webapps (Or under Webcontent in eclipse).

Edited index.html as and it worked fine

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值