![](/img/trans.png)
[英]Copy files from one target folder to another in multimodule maven project
[英]Maven: Import target folder from another module
我有两个模块:BE和FE(表示后端和前端)。 FE模块使用gulp构建,并将结果放入target
文件夹中。 BE模块写在Spring Boot上。 有什么方法可以将资源从target
文件夹FE的模块导入到BE模块并打包到spring boot jar中,使其成为独立的jar?
默认情况下,Spring Boot从类路径中的目录中提供静态内容:
默认情况下,资源映射在/ **上,但是您可以使用spring.mvc.static-path-pattern属性进行调整
webjar的特殊情况。 jar文件将提供/ webjars / **中具有路径的所有资源。
文档中的更多信息静态内容
因此,您需要更改存储FE文件的位置。 或者,您可以自定义MVC配置:
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations("/mycustompath", "classpath:/anotherone/")
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.