我们使用JAWR 3.7 库进行捆绑和缩小。我们的网络服务器是 Apache 8.0.26
当我们在 Eclipse 4.5 中运行项目时运行没有任何问题,但是当使用 intellij 作为 IDE 并运行它时
我们看到这个错误
代码详情:
下颚属性:
# Common properties
jawr.debug.on=false
jawr.gzip.on=true
jawr.gzip.ie6.on=false
jawr.charset.name=UTF-8
jawr.css.bundle.all.id=/content/css/all.css
jawr.css.bundle.all.mappings=/WEB-INF/Resources/css/bootstrap.css\
,/WEB-INF/Resources/css/alertify/alertify_core.css\
,/WEB-INF/Resources/css/alertify/alertify_bootstrap.css
jawr.css.bundle.mine.id=/content/css/myall.css
jawr.css.bundle.mine.mappings=/WEB-INF/Resources/css/all2.css
jawr.js.bundle.jquery.id=/content/js/jquery.js
jawr.js.bundle.jquery.mappings=\
/WEB-INF/Resources/js/jquery-2.0.3.js\
,/WEB-INF/Resources/js/bootstrap.js\
,/WEB-INF/Resources/js/alertify/alertify.js\
,/WEB-INF/Resources/js/jquery.ui.widget.js\
,/WEB-INF/Resources/js/jquery.fileupload.js\
jawr.js.bundle.angular.id=/content/js/angular.js
jawr.js.bundle.angular.mappings=/WEB-INF/Resources/js/angular.js\
,/WEB-INF/Resources/js/angular-resource.js\
,/WEB-INF/Resources/js/angular-route.js\
,/WEB-INF/Resources/js/angular-animate.js\
,/WEB-INF/Resources/js/angular-touch.js
jawr.js.bundle.app.id=/content/js/app.js
jawr.js.bundle.app.mappings=/WEB-INF/Resources/js/app/app.js\
,/WEB-INF/Resources/js/app/globalController.js\
,/WEB-INF/Resources/js/app/defaultController.js\
,/WEB-INF/Resources/js/app/customerController.js\
,/WEB-INF/Resources/js/app/jewelleryController.js\
,/WEB-INF/Resources/js/app/orderController.js\
,/WEB-INF/Resources/js/sg/sg-all.js
启动类:
public class Startup implements WebApplicationInitializer {
public void onStartup(ServletContext servletContext) throws ServletException {
WebApplicationContext context = this.getContext();
ContextLoaderListener listener = new ContextLoaderListener(context);
servletContext.addListener(listener);
ServletRegistration.Dynamic dispatcherServlet = servletContext.addServlet("dispatcherServlet", new DispatcherServlet(context));
dispatcherServlet.setLoadOnStartup(1);
dispatcherServlet.addMapping("/");
ServletRegistration.Dynamic javascriptServlet = servletContext.addServlet("javascriptServlet" , new JawrServlet());
javascriptServlet.setInitParameter("configLocation", "org/risman/config/jawr.properties");
javascriptServlet.setInitParameter("type", JawrConstant.JS_TYPE);
javascriptServlet.setLoadOnStartup(1);
javascriptServlet.addMapping("*.js");
ServletRegistration.Dynamic styleServlet = servletContext.addServlet("styleServlet" , new JawrServlet());
styleServlet.setInitParameter("configLocation", "org/risman/config/jawr.properties");
styleServlet.setInitParameter("type", JawrConstant.CSS_TYPE);
styleServlet.setLoadOnStartup(1);
styleServlet.addMapping("*.css");
}
private WebApplicationContext getContext() {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.register(WebConfig.class);
return context;
}
}
网络配置:
@Configuration
@EnableWebMvc
@ComponentScan( basePackages= {"org.risman.controller" })//, "org.risman.repository" , "org.risman.service"} )
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/res/**").addResourceLocations("/WEB-INF/Resources/")
.resourceChain(true).addResolver(new GzipResourceResolver());
}
@Bean
public ViewResolver viewResolver(){
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setSuffix(".jsp");
resolver.setPrefix("/WEB-INF/Views/");
return resolver;
}
}
索引.jsp:
<head>
<%@ taglib prefix="jw" uri="http://jawr.net/tags" %>
<%--<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>--%>
<jw:style src="/content/css/all.css" useRandomParam="false"></jw:style>
<jw:style src="/content/css/myall.css" useRandomParam="false"></jw:style>
<jw:script src="/content/js/jquery.js" useRandomParam="false" async="false"></jw:script>
<jw:script src="/content/js/angular.js" useRandomParam="false" async="false"></jw:script>
<jw:script src="/content/js/app.js" useRandomParam="false" async="false"></jw:script>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width"/>
为什么我们的代码在 ECLIPSE 上有效,但在 IntelliJ 中出错???!!!!!!
似乎所有配置、代码、Web 服务器……都在同一个