0

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" />

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

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

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

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
cakduro
  • 180
  • 2
  • 13

1 Answers1

1

You should create a source structure like the following:

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

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

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.

The src/main/webapp/ will contain your web application specific files.

Also make sure that the <packaging>war</packaging> tag is added to your pom.

maba
  • 47,113
  • 10
  • 108
  • 118
  • I already have that source structure, but when I run the maven (using this command : mvn tomcat:run) and call my project in the browser, the style/css not work. Any other solution??? – cakduro Oct 01 '12 at 08:49
  • Well it seems like you have to add some pieces to the Tomcat `server.xml` according to this SO question: http://stackoverflow.com/questions/10894779/gzip-compression-for-jsf-stuff – maba Oct 01 '12 at 09:06