Skip to content

Commit 1e7dfcf

Browse files
committed
Cache Maven Dists downloaded by the Maven Wrapper
1 parent b622de1 commit 1e7dfcf

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

__tests__/cache.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,17 @@ describe('dependency cache', () => {
100100
await expect(restore('maven', '')).rejects.toThrow(
101101
`No file in ${projectRoot(
102102
workspace
103-
)} matched to [**/pom.xml], make sure you have checked out the target repository`
103+
)} matched to [**/pom.xml,.mvn/wrapper/maven-wrapper.properties], make sure you have checked out the target repository`
104104
);
105105
});
106106
it('downloads cache', async () => {
107107
createFile(join(workspace, 'pom.xml'));
108108

109109
await restore('maven', '');
110110
expect(spyCacheRestore).toHaveBeenCalled();
111-
expect(spyGlobHashFiles).toHaveBeenCalledWith('**/pom.xml');
111+
expect(spyGlobHashFiles).toHaveBeenCalledWith(
112+
'**/pom.xml\n.mvn/wrapper/maven-wrapper.properties'
113+
);
112114
expect(spyWarning).not.toHaveBeenCalled();
113115
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
114116
});

dist/cleanup/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51467,9 +51467,12 @@ const CACHE_KEY_PREFIX = 'setup-java';
5146751467
const supportedPackageManager = [
5146851468
{
5146951469
id: 'maven',
51470-
path: [(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository')],
51470+
path: [
51471+
(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository'),
51472+
(0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists')
51473+
],
5147151474
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
51472-
pattern: ['**/pom.xml']
51475+
pattern: ['**/pom.xml', '.mvn/wrapper/maven-wrapper.properties']
5147351476
},
5147451477
{
5147551478
id: 'gradle',

dist/setup/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77331,9 +77331,12 @@ const CACHE_KEY_PREFIX = 'setup-java';
7733177331
const supportedPackageManager = [
7733277332
{
7733377333
id: 'maven',
77334-
path: [(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository')],
77334+
path: [
77335+
(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository'),
77336+
(0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists')
77337+
],
7733577338
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
77336-
pattern: ['**/pom.xml']
77339+
pattern: ['**/pom.xml', '.mvn/wrapper/maven-wrapper.properties']
7733777340
},
7733877341
{
7733977342
id: 'gradle',

src/cache.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ interface PackageManager {
2323
const supportedPackageManager: PackageManager[] = [
2424
{
2525
id: 'maven',
26-
path: [join(os.homedir(), '.m2', 'repository')],
26+
path: [
27+
join(os.homedir(), '.m2', 'repository'),
28+
join(os.homedir(), '.m2', 'wrapper', 'dists')
29+
],
2730
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
28-
pattern: ['**/pom.xml']
31+
pattern: ['**/pom.xml', '.mvn/wrapper/maven-wrapper.properties']
2932
},
3033
{
3134
id: 'gradle',

0 commit comments

Comments
 (0)