gpt4 book ai didi

spring-boot - Intellij Spring Boot 项目运行配置

转载 作者:行者123 更新时间:2023-12-05 02:11:08 24 4
gpt4 key购买 nike

我使用 mvn install 从命令行运行我的 Spring Boot 项目,然后使用 mvn spring-boot:run -Dspring.profiles.active="development"。这工作正常但不是很方便。我想通过单击绿色运行按钮直接从 Intellij 启动它。

我尝试添加新的运行配置但没有成功。我设置了“主类”和“事件配置文件”并尝试添加“运行 maven 目标”但最后一个不起作用(当我选择工作目录时 - 带有 pom.xml 的目录 - 它说找不到 Maven 项目)。我到底应该设置什么?我只想从项目的根目录运行上面提到的两个命令。

更新:这里是项目结构project structure

最佳答案

请按照以下步骤操作:

  1. 点击 IntelliJ 中的“+”(圆圈区域)设置 maven 目标 enter image description here

  2. 编写mvn installenter image description here

  3. 将 VM 选项设置为:-Dspring.profiles.active=development

之后,只需单击绿色播放按钮,它就应该可以正常运行了。

关于spring-boot - Intellij Spring Boot 项目运行配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57910577/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com