我使用gradle启动我的应用。但是当我停止我的任务时,我有一个问题,角度应用程序不停止。
每次启动服务器时,端口都在使用中:
端口4200已在使用中。使用'--port'指定其他端口。
这是我的build.gradle:
// frontend build.gradle
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.moowork.gradle:gradle-node-plugin:1.1.1"
}
}
apply plugin: "com.moowork.node"
//def generatedWebResources = "${buildDir}/generated-web-resources"
/*sourceSets {
main {
output.dir(generatedWebResources, builtBy: 'npm_run_build')
}
}*/
// configure gradle-node-plugin
node {
version = '7.5.0'
npmVersion = '4.1.2'
download = false
workDir = file("${project.projectDir}/node")
nodeModulesDir = file("${project.projectDir}/")
}
// clean node/node_modules/dist
task npmClean(type: Delete) {
final def webDir = "${rootDir}/frontend"
delete "${webDir}/node"
delete "${webDir}/node_modules"
delete "${webDir}/dist"
delete "${webDir}/coverage"
}
// clean task for npm
task clean {}
clean.dependsOn(npmClean)
// build task for npm
task build {}
build.dependsOn(npm_install)
build.dependsOn(npm_run_build)
// assemble task for npm
task assemble {}
assemble.dependsOn(build)
// check task for npm
task check {}
check.dependsOn(npm_run_test)
// run all task
task runAll{}
runAll.dependsOn(npm_run_start)
的package.json:
{
"name": "frontend",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve --port 4200 --live-reload-port 50000 --proxy-config proxy.conf.json",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"build": "ng build"
},
"private": true,
"dependencies": {
"@angular/common": "^2.4.0",
"@angular/compiler": "^2.4.0",
"@angular/core": "^2.4.0",
"@angular/forms": "^2.4.0",
"@angular/http": "^2.4.0",
"@angular/platform-browser": "^2.4.0",
"@angular/platform-browser-dynamic": "^2.4.0",
"@angular/router": "^3.4.0",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/cli": "1.0.0-beta.31",
"@angular/compiler-cli": "^2.4.0",
"@types/jasmine": "2.5.38",
"@types/moment": "2.13.0",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.0",
"webdriver-manager": "10.2.5"
}
}