简体   繁体   中英

Maven: Import target folder from another module

I have two modules: BE and FE (means backend and frontend). FE modules builds with gulp and results are placed into target folder. BE modules is written on spring boot. Is there any way to import resources from target folder FE's module to BE module and pack into spring boot jar to make it standalone jar?

By default, Spring Boot serves static content from a directory in the classpath called:

  • /static
  • /public
  • /resources
  • /META-INF/resources

By default, resources are mapped on /**, but you can tune that with the spring.mvc.static-path-pattern property

Special case for webjar. Any resources with a path in /webjars/** are served from jar files.

More info in the documentation Static Content

So you'll need to change where you store your FE file. Or you can customize your MVC configuration:

@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**")
            .addResourceLocations("/mycustompath", "classpath:/anotherone/")
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM