build.sh 1.0 KB

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