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 8111091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:58:55+00:00 2026-06-06T01:58:55+00:00

Gradle is giving me fits. I have a build.gravle that includes the java plug-in

  • 0

Gradle is giving me fits. I have a build.gravle that includes the java plug-in and I have built a task within it that generates a properties file and drops it into the build/classes directory. This all works like a champ. Here is my custom task.

task generateBuildSignature << {
    def whoami = System.getProperty( 'user.name' );
    def hostname = InetAddress.getLocalHost().getHostName();
    def buildTag = System.env.BUILD_TAG ?: "dev"

    ant.propertyfile( file: "${buildDir}/buildsignature.properties", comment: "This file is automatically generated - DO NOT EDIT!" ) {
        entry( key: "version", value: "${project.version}" )
        entry( key: "buildTimestamp", value: "${new Date().format('yyyy-MM-dd HH:mm:ss z')}" )
        entry( key: "buildUser", value: "$whoami" )
        entry( key: "buildSystem", value: "$hostname" )
        entry( key: "buildTag", value: "$buildTag" )
    }
}

Now I want to get the execution of this task integrated into the Java build lifecycle, preferably immediately after processResources or as a dependency of classes, but I’m at Chapter 23 of the documentation http://gradle.org/docs/current/userguide/java_plugin.html and it is not yet clear exactly how get my task into the dependency chain of the task(s) that come in through the java plug-in. Any advice for a fledgling gradle user?

  • 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-06T01:58:57+00:00Added an answer on June 6, 2026 at 1:58 am

    All you have to (and can) do is to add a task dependency. For example:

    classes.dependsOn(generateBuildSignature)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gradle build script similar to: apply plugin: 'war' task genSources <<
i have run a code snippet from Gradle Cookbook apply plugin: 'java' task create-dirs
I have a Gradle build in Jenkins with various JUnit tests that are executed
I have a multi-project C++ Gradle build, which produces a number of libraries and
we use Gradle for building Java projects and at the moment we have Ivy
Is there a way to build custom test phases in gradle? I have a
I have a Gradle build script, with mixed Maven dependencies (I use Maven Central
I have pretty sophisticated build using gradle - with a number of own gradle
Is their some build syntax or something in the Gradle API that I can
my build.gradle looks like: apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'application' ......

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.