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

  • Home
  • SEARCH
  • 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 4113762
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:22:04+00:00 2026-05-20T22:22:04+00:00

I have a jsp that contains a css link that looks like <link type=text/css

  • 0

I have a jsp that contains a css link that looks like

<link type="text/css" href="/css/login-min.css" rel="stylesheet" />

In order to keep browsers from caching the css file we replace login-min.css with the name of the css and a timestamp or version number

login-min.css?t=432432423423...

In ant I would do something like

<tstamp>
  <format property="current.time" pattern="MMddyyyyhhmmssaa" offset="-5" unit="hour" />
</tstamp>

<replace dir="${deploy.path}/${name}/WEB-INF/jsp" value="login-min.css?t=${current.time}">
  <include name="includes/login_css_include.jsp" />
  <replacetoken>login-min.css</replacetoken>
</replace>

For gradle I’ve updated the jsp page to look like

<link type="text/css" href="/css/@loginCSS@" rel="stylesheet" />

and in the build.gradle am doing

import org.apache.tools.ant.filters.ReplaceTokens
war {
  webInf {
    from ("${webAppDir}/WEB-INF/jsp") {
      include: "/includes/login_css_include.jsp"
      filter(ReplaceTokens, tokens: [loginCSS: 'login-min.css?v=1'])
    }
  }
}

but this isn’t working.

This one works but it changes the source… I just want the files in the war to be modified.

import org.apache.tools.ant.filters.ReplaceTokens
war {
  webInf {
    from ("${webAppDir}/WEB-INF/jsp/includes/login_css_include.jsp") {
      it.eachFile {
        ant.replace(file: it.file, token: "@loginCSS@", value: "login-min.css?v=1")
      }
    }
  }
}

I’m brand new to gradle am I going about this totally incorrectly? Anyone needed to do something like this before? Using gradle 1.0-milestone-1.

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-05-20T22:22:05+00:00Added an answer on May 20, 2026 at 10:22 pm

    Ok, this seems to work:

    jsp page:

    <link type="text/css" href="/css/@loginCSS@" rel="stylesheet" />
    

    build.gradle:

    war {
       filter(ReplaceTokens, tokens: ['loginCSS': 'login-min.css'])
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jsp file that contains this code, <form id=testForm> <input type=hidden value=study--study
I have written a small JSP page that contains a text box and a
I have jsp page that contains <span class=requiredFieldsMessageAsterix>*</span> I use a jsp include to
Suppose I have a JSP file that contains a tag (hence a .tag file).
I have a .jsp that contains an IFrame with a page that has some
I have a simple JSP that contains checkbox and submit button: <form action=MappingSubmit.jsp enctype=multipart/form-data
I have 2 pages written in JSP the first page contains: <%@page contentType=text/html pageEncoding=UTF-8%>
I have a welcome page (JSP file) for my application that contains some dynamic
I have a JSP that contains the content at the top of my page,
I have a JSP file that contains lots of if statements. Is there 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.