Cache Maven Dists downloaded by the Maven Wrapper

This commit is contained in:
Yeikel 2023-02-12 15:56:56 -05:00 committed by Yeikel Santana
parent b622de1dfa
commit 1e7dfcff06
4 changed files with 19 additions and 8 deletions

View File

@ -100,7 +100,7 @@ describe('dependency cache', () => {
await expect(restore('maven', '')).rejects.toThrow(
`No file in ${projectRoot(
workspace
)} matched to [**/pom.xml], make sure you have checked out the target repository`
)} matched to [**/pom.xml,.mvn/wrapper/maven-wrapper.properties], make sure you have checked out the target repository`
);
});
it('downloads cache', async () => {
@ -108,7 +108,9 @@ describe('dependency cache', () => {
await restore('maven', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith('**/pom.xml');
expect(spyGlobHashFiles).toHaveBeenCalledWith(
'**/pom.xml\n.mvn/wrapper/maven-wrapper.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
});

View File

@ -51467,9 +51467,12 @@ const CACHE_KEY_PREFIX = 'setup-java';
const supportedPackageManager = [
{
id: 'maven',
path: [(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository')],
path: [
(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository'),
(0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists')
],
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
pattern: ['**/pom.xml']
pattern: ['**/pom.xml', '.mvn/wrapper/maven-wrapper.properties']
},
{
id: 'gradle',

7
dist/setup/index.js vendored
View File

@ -77331,9 +77331,12 @@ const CACHE_KEY_PREFIX = 'setup-java';
const supportedPackageManager = [
{
id: 'maven',
path: [(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository')],
path: [
(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository'),
(0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists')
],
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
pattern: ['**/pom.xml']
pattern: ['**/pom.xml', '.mvn/wrapper/maven-wrapper.properties']
},
{
id: 'gradle',

View File

@ -23,9 +23,12 @@ interface PackageManager {
const supportedPackageManager: PackageManager[] = [
{
id: 'maven',
path: [join(os.homedir(), '.m2', 'repository')],
path: [
join(os.homedir(), '.m2', 'repository'),
join(os.homedir(), '.m2', 'wrapper', 'dists')
],
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
pattern: ['**/pom.xml']
pattern: ['**/pom.xml', '.mvn/wrapper/maven-wrapper.properties']
},
{
id: 'gradle',