【问题标题】:Integrating angular cli project with groovy gradle app将 Angular cli 项目与 groovy gradle 应用程序集成
【发布时间】:2017-07-04 20:24:56
【问题描述】:

我正在尝试将 angular-cli 的种子项目与我的由 Gradle 打包并部署在 tomcat 服务器中的 java 应用程序集成。

如何将 Angular 构建与 Gradle 构建集成?最好将我的项目的编译后的 scss 文件放在哪里。我正在考虑将它们放在资产下,编译后的 css 文件也将在资产下生成。

这是我的文件夹结构:

myApp
├── gradle
├── src
│   └── main
│       ├── groovy
│       ├── resources
│       ├── webapp
│       └── ngapp
             ├── angular-cli.json
             ├── e2e
             ├── karma.conf.js
             ├── node_modules
             ├── package.json
             ├── protractor.conf.js
             ├── tslint.json
             ├── tsconfig.json
             ├── WEB-INF
             ├── src
                 ├── app //app component and other features components here
                 ├── assets
                 ├── environments
                 ├── typings.d.ts
                 ├── index.html
                 ├── main.ts
                 ├── polyfills.ts
                 ├── styles.css
                 └── tsconfig.app.json

.angular-cli.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "ngapp"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "../webapp/ng",
      "assets": [
        "assets"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "tsconfig": "tsconfig.json",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/main/ngapp/tsconfig.json"
    }
  ],
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

tsconfig.json:

  {
      "compileOnSave": false,
      "compilerOptions": {
        "outDir": "./dist/out-tsc",
        "baseUrl": "src/main/ngapp",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es5",
        "typeRoots": [
          "node_modules/@types"
        ],
        "lib": [
          "es2016",
          "dom"
        ]
      }
}

【问题讨论】:

    标签: angular gradle angular-cli


    【解决方案1】:

    可能有问题

     "lint": [{
      "project": "src/main/ngapp/tsconfig.json"
    }]
    

    通常是这样的

    "lint": [{
      "project": "src/tsconfig.json"
    }]
    

    【讨论】:

    • 我通过在我的 src/main/ 下重新生成项目来解决它。仍在努力与 gradle build 集成。
    猜你喜欢
    • 2020-01-26
    • 1970-01-01
    • 2017-11-15
    • 2017-11-29
    • 1970-01-01
    • 1970-01-01
    • 2017-01-05
    • 1970-01-01
    • 2018-07-20
    相关资源
    最近更新 更多