Compare commits

..

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 9a1f2f556b Add interactiveMode false to generated maven settings.xml 2026-06-23 02:06:00 +00:00
copilot-swe-agent[bot] eb4afe2a5b Initial plan 2026-06-23 02:04:03 +00:00
8 changed files with 14 additions and 38 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ Currently, the following distributions are supported:
The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files: The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties` - gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties`
- maven: `**/pom.xml`, `**/.mvn/wrapper/maven-wrapper.properties`, and `**/.mvn/extensions.xml` - maven: `**/pom.xml` and `**/.mvn/wrapper/maven-wrapper.properties`
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt` - sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt`
When the option `cache-dependency-path` is specified, the hash is based on the matching file. This option supports wildcards and a list of file names, and is especially useful for monorepos. When the option `cache-dependency-path` is specified, the hash is based on the matching file. This option supports wildcards and a list of file names, and is especially useful for monorepos.
+2
View File
@@ -160,6 +160,7 @@ describe('auth tests', () => {
const expectedSettings = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" const expectedSettings = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<interactiveMode>false</interactiveMode>
<servers> <servers>
<server> <server>
<id>${id}</id> <id>${id}</id>
@@ -181,6 +182,7 @@ describe('auth tests', () => {
const expectedSettings = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" const expectedSettings = `<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<interactiveMode>false</interactiveMode>
<servers> <servers>
<server> <server>
<id>${id}</id> <id>${id}</id>
+4 -22
View File
@@ -96,11 +96,11 @@ describe('dependency cache', () => {
}); });
describe('for maven', () => { describe('for maven', () => {
it('throws error if no pom.xml, maven-wrapper.properties, or extensions.xml found', async () => { it('throws error if no pom.xml or maven-wrapper.properties found', async () => {
await expect(restore('maven', '')).rejects.toThrow( await expect(restore('maven', '')).rejects.toThrow(
`No file in ${projectRoot( `No file in ${projectRoot(
workspace workspace
)} matched to [**/pom.xml,**/.mvn/wrapper/maven-wrapper.properties,**/.mvn/extensions.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 based on pom.xml', async () => { it('downloads cache based on pom.xml', async () => {
@@ -115,7 +115,7 @@ describe('dependency cache', () => {
expect.any(String) expect.any(String)
); );
expect(spyGlobHashFiles).toHaveBeenCalledWith( expect(spyGlobHashFiles).toHaveBeenCalledWith(
'**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties\n**/.mvn/extensions.xml' '**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties'
); );
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found'); expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
@@ -136,25 +136,7 @@ describe('dependency cache', () => {
expect.any(String) expect.any(String)
); );
expect(spyGlobHashFiles).toHaveBeenCalledWith( expect(spyGlobHashFiles).toHaveBeenCalledWith(
'**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties\n**/.mvn/extensions.xml' '**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
});
it('downloads cache based on extensions.xml', async () => {
createDirectory(join(workspace, '.mvn'));
createFile(join(workspace, '.mvn', 'extensions.xml'));
await restore('maven', '');
expect(spyCacheRestore).toHaveBeenCalledWith(
[
join(os.homedir(), '.m2', 'repository'),
join(os.homedir(), '.m2', 'wrapper', 'dists')
],
expect.any(String)
);
expect(spyGlobHashFiles).toHaveBeenCalledWith(
'**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties\n**/.mvn/extensions.xml'
); );
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found'); expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
+1 -5
View File
@@ -51973,11 +51973,7 @@ const supportedPackageManager = [
(0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists') (0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists')
], ],
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
pattern: [ pattern: ['**/pom.xml', '**/.mvn/wrapper/maven-wrapper.properties']
'**/pom.xml',
'**/.mvn/wrapper/maven-wrapper.properties',
'**/.mvn/extensions.xml'
]
}, },
{ {
id: 'gradle', id: 'gradle',
+2 -5
View File
@@ -77727,6 +77727,7 @@ function generate(id, username, password, gpgPassphrase) {
'@xmlns': 'http://maven.apache.org/SETTINGS/1.0.0', '@xmlns': 'http://maven.apache.org/SETTINGS/1.0.0',
'@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', '@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'@xsi:schemaLocation': 'http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd', '@xsi:schemaLocation': 'http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd',
interactiveMode: false,
servers: { servers: {
server: [ server: [
{ {
@@ -77837,11 +77838,7 @@ const supportedPackageManager = [
(0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists') (0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists')
], ],
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
pattern: [ pattern: ['**/pom.xml', '**/.mvn/wrapper/maven-wrapper.properties']
'**/pom.xml',
'**/.mvn/wrapper/maven-wrapper.properties',
'**/.mvn/extensions.xml'
]
}, },
{ {
id: 'gradle', id: 'gradle',
+2
View File
@@ -400,6 +400,7 @@ The two `settings.xml` files created from the above example look like the follow
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<interactiveMode>false</interactiveMode>
<servers> <servers>
<server> <server>
<id>github</id> <id>github</id>
@@ -419,6 +420,7 @@ The two `settings.xml` files created from the above example look like the follow
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<interactiveMode>false</interactiveMode>
<servers> <servers>
<server> <server>
<id>maven</id> <id>maven</id>
+1
View File
@@ -80,6 +80,7 @@ export function generate(
'@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', '@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'@xsi:schemaLocation': '@xsi:schemaLocation':
'http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd', 'http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd',
interactiveMode: false,
servers: { servers: {
server: [ server: [
{ {
+1 -5
View File
@@ -28,11 +28,7 @@ const supportedPackageManager: PackageManager[] = [
join(os.homedir(), '.m2', 'wrapper', 'dists') join(os.homedir(), '.m2', 'wrapper', 'dists')
], ],
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven // https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
pattern: [ pattern: ['**/pom.xml', '**/.mvn/wrapper/maven-wrapper.properties']
'**/pom.xml',
'**/.mvn/wrapper/maven-wrapper.properties',
'**/.mvn/extensions.xml'
]
}, },
{ {
id: 'gradle', id: 'gradle',