将src / main / webapp添加到jar以启动弹出 [英] Add src/main/webapp to jar for spring boot

查看:241
本文介绍了将src / main / webapp添加到jar以启动弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

弹簧启动文档说您应该将静态html资源放在/ static(或/ public / / resources或/ META-INF / resources)下。
但是这会导致2个问题:


  1. 我正在使用外部工具来编辑这些文件,而Eclipse
    2秒后刷新(所以当我编辑html文件时,我不能
    只是刷新页面:我必须等待...)

  2. 每当我更改一个
    java文件,一个复制3268资源任务开始:需要时间,
    ,如果我在调试中启动应用程序如果任务是
    未完成,则崩溃。

那么,我如何设置我的maven包阶段来复制文件,同时保持一切的方式是调试(编译阶段?)

解决方案

使用此插件 https://maven.apache.org/plugins/maven-resources- plugin / examples / copy-resources.html ,您可以在maven的指定阶段复制文件。



但是我从来没有遇到你提到的问题,我使用的是Intellij Idea,你应该尝试一下


The spring boot docs says you should put the "static" html resources under /static (or /public or /resources or /META-INF/resources). But this leads to 2 problems:

  1. I'm using an external tool to edit those files, and Eclipse refreshes after 2 seconds (so when I'm editing an html file, I can't just refresh the page: I have to wait...)
  2. whenever I change a java file, a "Copying 3268 resources" task starts: it takes time, and if I start the app in debug it actually crashes if the task is not finished.

So: how can I set my maven "package" phase to copy those files, while keeping everything the way it is for debugging ("compile" phase?)

解决方案

Using this plugin https://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html you can copy files during the specified phase on maven.

But I've never had the problem you mentioned, I'm using Intellij Idea, you should give it a try

这篇关于将src / main / webapp添加到jar以启动弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆