我想使用wget在我的spring boot应用程序中创建一个静态页面。
因此,我构建了一个bash脚本:
mvn spring-boot:run &
wget localhost:8080 --directory-prefix=./docs/ --no-host-directories --recursive --convert-links --adjust-extension
但是,在wget尝试获取链接之前,Maven不会启动spring boot应用程序。我试着使用wait
,但是wget根本没有启动它的工作。
发布于 2019-04-09 21:02:49
我通过等待Tomcat启动然后执行wget解决了这个问题:
mvn spring-boot:run &
( echo "Waiting... Tomcat to launch on 8080..."
while ! nc -z localhost 8080; do
sleep 0.1 # wait for 1/10 of the second before check again
done
echo "Tomcat launched" &&
wget localhost:8080 --directory-prefix=./docs/ --no-host-directories --recursive --convert-links --adjust-extension )
https://stackoverflow.com/questions/55574552
复制相似问题