由于现在项目采用的是 jboot 框架,升级最新版本2.1.5后,需要将原来的webroot资源改到 src/main/webapp目录下,

发现转移后,通过框架的app.java入口main函数无法将新增过来的webapp资源更新到target/classes下面,

所以用下面maven配置文件 可以有效解决。

<plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/classes/webapp</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/../jyb_project/src/main/webapp</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

上面的  resources 是欲拷贝的目录, outputDirectory是目标目录。

------------------------------------------------------------------------------

这个maven流弊之处在于 支持html,等静态资源 热编译,在当前改动的html下面 按下ctrl+f9或者点击build project 可以自动将改动html平移到了target目录下。

难道是 idea 的 build project会根据maven的配置文件的参数编译? 反正 很流弊,记录一下。

posted on 2019-08-02 11:39  菜霸  阅读(3149)  评论(0编辑  收藏  举报