【问题标题】:Spring boot dev tools not working in Net beansSpring Boot devtools 在 Netbeans 中不起作用
【发布时间】:2017-07-28 06:01:39
【问题描述】:

我已经阅读了 Spring Boot 开发工具并想尝试一下,我将以下内容添加到我的 pom 中

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

并在 Net beans 选项中开启 devtools 重启手动触发。 要运行,我在运行项目-> 执行目标中使用以下选项 org.springframework.boot:spring-boot-maven-plugin:1.3.2.RELEASE:run 但是当我更改代码时,项目不会重新运行。我错过了什么?

【问题讨论】:

    标签: java spring-boot netbeans-8 spring-boot-devtools


    【解决方案1】:

    单击项目下的属性-> 构建-> 编译是一个复选框“保存时编译”,它被勾选。通过修改 .java 文件并检查 /target/classes 中的时间戳来验证这确实有效。

    还可以通过将 Netbeans 项目属性中的 Run project Action 中的 Execute 目标更改为以下内容:

    process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec

    为 pom.xml 配置显式资源目录位置(在我的例子中是 src/main/resources)解决了不重新加载的问题:

    <build>
       ...
       <resources>
         <resource>
           <directory> src/main/resources </directory>
         </resource>
       </resources>
      ... 
     </build>
    

    【讨论】:

      猜你喜欢
      • 2017-08-26
      • 2021-10-28
      • 2021-07-15
      • 1970-01-01
      • 2018-08-29
      • 2016-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多