Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8631405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:12:54+00:00 2026-06-12T09:12:54+00:00

I work on a struts2 project using maven to compile. I am trying to

  • 0

I work on a struts2 project using maven to compile. I am trying to minify the javascript files, which are located in different locations.

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.3.0</version>
    <executions>
      <execution>
        <goals>
          <goal>compress</goal>
        </goals>
      </execution>
    </executions>        
    <configuration>
      <nosuffix>true</nosuffix>
    </configuration>
  </plugin>

I assume that by doing this, all js files will be minified and replaced the original file in the production war file (according to definition for nosuffix).

However it doesn’t seem to be the case. How can I acheve this?

Secondly, if I choose to use the one with the suffix, I assume I have to manually change the scripts reference in my jsp files is that correct? If so, how do I set it so that it will remove the original without the suffix?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:12:55+00:00Added an answer on June 12, 2026 at 9:12 am

    I have found working solution here. Basically you need to place the following into you pom.xml (replacing only the path to you js and css files inside src/main/webapp folder):

        <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webResources>
                        <!-- Add minified resources -->
                        <resource>
                            <directory>${project.build.directory}/minimized</directory>
                            <targetPath>/</targetPath>
                            <filtering>false</filtering>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
    
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>yuicompressor-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>compress</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <nosuffix>true</nosuffix>
                </configuration>
            </plugin>
        </plugins>
    
        <pluginManagement>
            <plugins>
                <!-- Javascript and CSS files compression -->
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>yuicompressor-maven-plugin</artifactId>
                    <version>1.1</version>
                    <configuration>
                        <!-- Don't output in the default webapp location, since the war plugin will overwrite the files in there
                        with the original, uncompressed ones. -->
                        <webappDirectory>${project.build.directory}/minimized</webappDirectory>
                        <jswarn>false</jswarn>
                        <!-- Overwrite existing files -->
                        <nosuffix>true</nosuffix>
                        <includes>
                            <include>%path to your js and css files inside src/main/webapp%/**/*</include>
                        </includes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        </build>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying get Struts 2 and Tiles to work and I am using
I'm using the Struts2 jQuery plugin 2.1 and render an autocompleter in my JSP.
I am using Maven2 eclipse plugin to download dependencies for my project. Although if
I'm interested in porting an existing application which was written using Spring/Struts2/Hibernate to GAE.
I am working on struts2 application in which i am using displaytag for pagination
I m trying to deploy two struts2 projects(ear files) in jboss 4.2.2GA.When i deploy
I want to create simple dummy tag which can work with Struts2. I have
Trying to work with multiple submit buttons within a single form in struts2 application
I'm working with a project that is setup using the standard Maven directory structure
I am using struts2-jquery Dialog Widget to open a JSP page, which has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.