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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:46:14+00:00 2026-06-01T06:46:14+00:00

Given that: There seems to be no easy way to get a list of

  • 0

Given that:

  • There seems to be no easy way to get a list of “changed” files in Jenkins (see here and here)
  • There seems to be no fast way to get a list of files changed since label xxxx

How can I go about optimising our build so that when we run PMD it only runs against files that have been modified since the last green build.

Backing up a bit… our PMD takes 3–4 minutes to run against ~1.5 million lines of code, and if it finds a problem the report invariably runs out of memory before it completes. I’d love to trim a couple of minutes off of our build time and get a good report on failures. My original approach was that I’d:

  • get the list of changes from Jenkins
  • run PMD against a union of that list and the contents of pmd_failures.txt
  • if PMD fails, include a list of failing files in pmd_failures.txt

More complicated than I’d like, but worth having a build that is faster but still reliable.

Once I realised that Jenkins was not going to easily give me what I wanted, I realised that there was another possible approach. We label every green build. I could simply get the list of files changed since the label and then I could do away with the pmd_failures.txt entirely.

No dice. The idea of getting a list of files changed since label xxxx from Perforce seems to have never been streamlined from:


    $ p4 files //path/to/branch/...@label > label.out
    $ p4 files //path/to/branch/...@now > now.out
    $ diff label.out now.out

Annoying, but more importantly even slower for our many thousands of files than simply running PMD.

So now I’m looking into trying to run PMD in parallel with other build stuff, which is still wasted time and resources and makes our build more complex. It seems to me daft that I can’t easily get a list of changed files from Jenkins or from Perforce. Has anyone else found reasonable workaround for these problems?

  • 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-01T06:46:16+00:00Added an answer on June 1, 2026 at 6:46 am

    I think I’ve found the answer, and I’ll mark my answer as correct if it works.

    It’s a bit more complex than I’d like, but I think it’s worth the 3-4 minutes saved (and potential memory issues).

    1. At the end of a good build, save the good changelist as a Perforce counter. (post-build task). Looks like this:
      $ p4 counter last_green_trunk_cl %P4_CHANGELIST%
      
    2. When running PMD, read the counter into the property last.green.cl and get the list of files from:
      $ p4 files //path/to/my/branch/...@${last.green.cl},now
      //path/to/my/branch/myfile.txt#123 - edit change 123456 (text)
      //path/to/my/branch/myotherfile.txt#123 - add change 123457 (text)
      etc...
      (have to parse the output)
      
    3. Run PMD against those files.

    That way we don’t need the pmd_failures.txt and we only run PMD against files that have changed since the last green build.

    [EDIT: changed it to use p4 counter, which is way faster than checking in a file. Also, this was very successful so I will mark it as answered]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given an object, is there any way to get notified of when that object
Original Problem: I have 3 boxes each containing 200 coins, given that there is
Are there equivalent to perl -c syntax check for JavaScript from command? Given that
Is there any Java lib that allows me to download web pages recursively given
Is there a built in Java code that will parse a given folder and
Is there any algorithm that gives the compass direction of a shadow given latitude,
I have a class called UserInfo that contains details about a given user. There
I know there's an easy way of doing this, but my recursion abilities are
Aside from parsing the function file, is there a way to get the names
Is there a set of functions that give you the file and/or the folder

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.