我正在尝试在 Docker 中运行 Maven。
所以我从她那里获取了镜像https://hub.docker.com/_/maven/.
docker pull maven
但是,当我运行它时:
docker run maven
我得到:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
我没有 Maven 经验,所以我不明白是什么导致了这个问题。
Docker 容器只安装了 Maven,但没有运行它,所以我不明白 Maven 如何抛出错误。
单击
clean install
后,您需要在目标选项卡中定义 build as maven
。