如何在IntelliJ中使用JAWR 3.7库? (在Eclipse中它工作但在IntelliJ中显示错误)

时间:2015-08-27 16:09:30

标签: java eclipse jsp intellij-idea jawr

我们使用JAWR 3.7库来进行捆绑和缩小。 我们的Web服务器是Apache 8.0.26

当我们在Eclipse 4.5中运行项目时没有任何问题但是什么时候运行 使用intellij作为IDE并运行它

我们看到此错误

例外明细: enter image description here

代码明细:

jawr.properties:

# 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;

    }

}

Web.config:

@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;

    }

}

index.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中的错误??? !!!!

似乎所有配置,代码,网络服务器......都在同一个

0 个答案:

没有答案