使maven提供像css.gz和js.gz文件 [英] Make maven serve files like css.gz and js.gz

查看:318
本文介绍了使maven提供像css.gz和js.gz文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手动压缩我的CSS使用手动gzip,我试图从外部源包括css.gz。

I have manually compressed my CSS using manual gzip and I'm trying to include css.gz from external source.

<link rel="stylesheet" href="<c:url value="/resources/css/style.css.gz"/>" type="text/css" media="screen" />

这很简单,当我使用PHP和Apache时效果很好。

It is simple and works well when I'm using PHP and Apache.

问题是,我现在正在使用一个Java EE项目使用spring和Apache Maven。

The problem is, I'm now working with a Java EE project using spring and Apache Maven.

所以,如何配置maven要了解类似这样的预压缩文件?

So, how to configure maven to know about precompressed files like that?

推荐答案

您应该创建如下的源结构:

You should create a source structure like the following:


.
├── pom.xml
└── src
    └── main
        ├── java
        ├── resources
        └── webapp
            ├── WEB-INF
            └── resources
                └── css
                    └── style.css.gz

src / main / java 将包含所有的java代码。

The src/main/java will contain all your java code.

src / main / resources / 应包含应用程序使用的资源,且不应公开。例如资源束,属性文件等。

The src/main/resources/ should contain resources used by your application and that should not be publicly available. For example Resource Bundles, property files etc.

src / main / webapp / 文件。

同时确保

< package> war< / package>

这篇关于使maven提供像css.gz和js.gz文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆