build.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. echo "判断node.js mvn是否存在"
  3. command -v npm || { echo >&2 "I require node.js v14.16.0+ but it's not installed. Aborting."; sleep 5; exit 1; }
  4. command -v mvn || { echo >&2 "I require maven 3.5 + but it's not installed. Aborting."; sleep 5; exit 1; }
  5. cd `dirname $0`
  6. BuildDir=`pwd` #工程根目录
  7. echo "build web"
  8. cd $BuildDir/report-ui
  9. echo "npm install"
  10. npm install
  11. echo "cp echarts map js"
  12. cp -r node_modules_echarts_need/* node_modules/echarts/
  13. echo "npm run build"
  14. npm run build:prod
  15. echo "publish web to springboot src/main/resources/static"
  16. rm -rf $BuildDir/report-core/src/main/resources/static
  17. mkdir -p $BuildDir/report-core/src/main/resources/static
  18. mv $BuildDir/report-ui/dist/* $BuildDir/report-core/src/main/resources/static/
  19. echo ""
  20. echo "build springboot"
  21. cd $BuildDir/report-core
  22. echo "mvn clean"
  23. mvn clean
  24. echo ""
  25. echo "mvn package"
  26. mvn package -Dmaven.test.skip=true
  27. echo "zip finish in build dir"
  28. if [ ! -d "$BuildDir/build" ]; then
  29. mkdir $BuildDir/build
  30. fi
  31. mv $BuildDir/report-core/target/aj-report-*.zip $BuildDir/build/
  32. rm -rf $BuildDir/report-core/src/main/resources/static/*
  33. echo "Finish"