build.sh 1018 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 ""
  12. echo "npm run build"
  13. npm run build:prod
  14. echo "publish web to springboot src/main/resources/static"
  15. mkdir -p $BuildDir/report-core/src/main/resources/static
  16. mv $BuildDir/report-ui/dist/* $BuildDir/report-core/src/main/resources/static/
  17. echo ""
  18. echo "build springboot"
  19. cd $BuildDir/report-core
  20. echo "mvn clean"
  21. mvn clean
  22. echo ""
  23. echo "mvn package"
  24. mvn package -Dmaven.test.skip=true
  25. echo "zip finish in build dir"
  26. if [ ! -d "$BuildDir/build" ]; then
  27. mkdir $BuildDir/build
  28. fi
  29. mv $BuildDir/report-core/target/aj-report-*.zip $BuildDir/build/
  30. rm -rf $BuildDir/report-core/src/main/resources/static/*
  31. echo "Finish"