Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Provides a solution for caching build dependencies for maven gradle #77

Merged
merged 4 commits into from Sep 11, 2017

Conversation

malston
Copy link
Contributor

@malston malston commented Aug 30, 2017

#68 Removed the m2 input from all the tasks and added caches for .m2 and .gradle directories.
Generate settings no longer copies contents from m2 resource and uses the Concourse cache feature instead, therefore, we could remove the m2 resource entirely along with the param to the m2 folder. This PR also caches the wrapper by setting the MAVEN_USER_HOME variable to the location of the m2 cache folder.

@marcingrzejszczak
Copy link
Contributor

@nebhale - do you have anything to add to this? I remember that you mentioned something about doing symbolic links to .m2...

@nebhale
Copy link
Contributor

nebhale commented Aug 31, 2017

I’d say that the work done around moving $M2_HOME around is a bit of overkill. @philwebb and I have more or less settled on the following pattern. A maven or gradle cache and a conditional symbolic link. The conditional link is useful for builds that run on non-containerized platforms (macOS) so that they don’t screw up the shared file system.

I found that moving $M2_HOME around was problematic specifically with regards to the Maven Wrapper (as you’ve seen) while the symbolic link was reliable in all cases.

@philwebb
Copy link

philwebb commented Aug 31, 2017

@nebhale @marcingrzejszczak I started putting together some generally useful scripts here. The setup_symlinks function will do what you want. You can see it being used here.

@marcingrzejszczak
Copy link
Contributor

Nice! I'll definitely check this out :) Thanks @philwebb

@malston
Copy link
Contributor Author

malston commented Aug 31, 2017

Got it... very straightforward approach. Thanks @philwebb @nebhale .

outputs:
- name: out
caches:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s no real reason that these need to be hidden directories. In fact, it’s probably easier that they aren’t, so that when you fly hijack it’s obvious that they’re there and being used. I’d just call them gradle and maven and then link them to their hidden locations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, makes sense.

Copy link
Contributor

@nebhale nebhale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From an inspection-only perspective (I didn’t run it, so don’t know if it actually works 😉) this looks good to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

4 participants