angular - 将Angular CLI项目与Groovy Gradle App集成

标签 angular gradle angular-cli

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

如何将 Angular 构建与Gradle构建集成在一起?最好将已编译的scss文件放入我的项目中。我正在考虑将它们放在 Assets 下,并且也将在 Assets 下生成已编译的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"
        ]
      }
}

最佳答案

也许与

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

通常看起来像这样
"lint": [{
  "project": "src/tsconfig.json"
}]

关于angular - 将Angular CLI项目与Groovy Gradle App集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44903627/

相关文章:

javascript - 按日期分组的问题

java - 我使用 gradle 构建了一个 fat jar,其中包含我所有的依赖项。现在,在使用 distZip 时,如何排除这些 jar 文件?

java - 使用 Gradle 构建 Eclipse 插件

java - Windows 上的 Gradle flatdir 获取 : Could not find property 'url'

angular - 错误的样式包路径

javascript - 如何在 Angular 中实现翻转时钟

javascript - 使用 jspdf 将数组导出为表

javascript - Angular 2.0 和 ng-model

node.js - 无法在 Ubuntu 中卸载 Angular CLI - 显示 `up to date in 0.083s`

尝试构建时出现 Angular 8 到 9 升级错误