user3863192 user3863192 - 2 years ago 3073
Node.js Question

Configure angular 2 project with maven and spring REST

I wanted to upgrade my small application from angular 1 to angular 2. I am somewhat new to angular 2 and node configurations. My web application use eclipse and maven. The problem is i could not able to configure using angular 2.

Can anyone please help me if there is any tutorial to configure it with directory structure?

There are maven plugins available but i am bit confused about the directory structure of my angular 2 app.

Thanks in advance.

Answer Source

Here from the angular site shows several demonstrations of how to structure an angular 2 project. In an eclipse maven web app I would start my client side files into the src/main/resources folder at the same level as the web-inf folder.

Maven pom.xml, include this into your project. Maven-fronted-plugin shouldn't be used for production. Maven will install two folders at the project root level with this setup, node and node_modules.

                        <id>install node and npm</id>

                        <id>npm install</id>
                        <!-- Optional configuration which provides for running any npm command -->

package.json add this to the root level of the project before maven clean install.

  "name": "budget_calculator",
  "version": "1.0.0",
  "dependencies": {
    "@angular/common":  "2.0.0-rc.1",
    "@angular/compiler":  "2.0.0-rc.1",
    "@angular/core":  "2.0.0-rc.1",
    "@angular/http":  "2.0.0-rc.1",
    "@angular/platform-browser":  "2.0.0-rc.1",
    "@angular/platform-browser-dynamic":  "2.0.0-rc.1",
    "@angular/router":  "2.0.0-rc.1",
    "@angular/router-deprecated":  "2.0.0-rc.1",
    "@angular/upgrade":  "2.0.0-rc.1",
    "systemjs": "0.19.27",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",
    "angular2-in-memory-web-api": "0.0.10",
    "bootstrap": "^3.3.6"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download