Bug 464597 - Git plugin's "clean after checkout" and Maven's "private repository" don't interact well
Summary: Git plugin's "clean after checkout" and Maven's "private repository" don't in...
Status: NEW
Alias: None
Product: Hudson
Classification: Technology
Component: Plugins (show other bugs)
Version: 3.2.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Winston Prakash CLA
QA Contact: Geoff Waymark CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-14 07:33 EDT by Andreas Sewe CLA
Modified: 2015-04-15 11:16 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2015-04-14 07:33:37 EDT
FYI, this is a consequence of Bug 415482 being fixed.

Consider the following scenario:

The "private repository" option is enabled (which is IMHO the only reliable way to use multiple jobs invoking "Maven 3" with Hudson) as is the "Clean after checkout" option.

As of version 2.2.8 of the Hudson Git plugin, the clean after checkout also deletes the local Maven repository below .maven/repository. This has the undesirable effect that jobs which use a "private repository" and "clean after checkout" (both options are IMHO necessary for proper reproducible builds) force Maven to download all necessary plugins and dependencies again.

It would thus be great if the Hudson Git plugin became aware of the special nature of .maven/repository. 

On a related note: Is there a difference between "Wipe out workspace" and "Clean after checkout"? I feel that the former should indeed wipe out everything, including .maven/repository, but the latter should not.
Comment 1 Andreas Sewe CLA 2015-04-14 08:48:42 EDT
(In reply to Andreas Sewe from comment #0)
For the record, a partial workaround is adding an explicit "Execute shell" build action before the "Invoke Maven 3" build action:

  git clean -fdx -e .maven/

Unfortunately, this not only preserves

  .maven/repo/

but also (if "Private temporary directory" is enabled)

  .maven/tmp/

so the workaround is not quite perfect.
Comment 2 Bob Foster CLA 2015-04-14 14:31:28 EDT
Would this do what you want?

git clean -fdx -e .maven/repo/
Comment 3 Andreas Sewe CLA 2015-04-15 11:16:53 EDT
(In reply to Bob Foster from comment #2)
> Would this do what you want?
> 
> git clean -fdx -e .maven/repo/

Unfortunately, no:

  > git init test
  > cd test
  > mkdir -p .maven/repo .maven/tmp
  > git clean -fdx -e .maven/repo/
  Removing .maven/

So, the exclusion won't be effective, as the parent directory has been deleted already. Hence, the above workaround is only "partial".