Skip to content

Compatibility with s4u/maven-settings-action (or any externally configured settings.xml) #59

Description

@rj93-finseta

Hi,

I am attempting to refactor our pipelines and I'd like to remove the repositories section from the projects POMs and instead rely on what is configured in single settings.xml that can be used everywhere.

This simplifies our POMs as we have lots of repositories where these repository configuration is duplicated.

I'm using s4u/maven-settings-action to setup the settings.xml file, which by creates /home/runner/.m2/settings.xml

I've tried to configure this action as follows:

uses: qcastel/github-actions-maven-release@v1.12.34
with:
  m2-home-folder: '/home/runner/.m2'

and in the logs I get:

WARN - No M2 folder '/home/runner/.m2' found. We therefore won't beneficy from the CI cache
Current branch: main
Release branch name: main
We are on the release branch
Using SSH folder /root/.ssh
Using M2 repository folder /home/runner/.m2
ls: /home/runner/.m2: No such file or directory
/home/runner/.m2 is empty, this means we didn't hit a potential M2 cache :(

I've also tried:

- name: Copy settings.xml
   run: |
     mkdir ${{ github.workspace}}/.m2
     cp /home/runner/.m2/settings.xml ${{ github.workspace }}/.m2/settings.xml
     cat ${{ github.workspace }}/.m2/settings.xml

- name: Release
  uses: qcastel/github-actions-maven-release@v1.12.34
  with:
    m2-home-folder: '${{ github.workspace }}/.m2'

- name: cat settings.xml
  if: always()
  run: |
    cat ${{ github.workspace}}/.m2/settings.xml

Which does seem to then pick up the directory from looking at the logs:

INFO - M2 folder '/github/workspace/.m2' not empty. We therefore will beneficy from the CI cache
Current branch: main
Release branch name: main
We are on the release branch
Using SSH folder /root/.ssh
Using M2 repository folder /github/workspace/.m2

However, that still doesn't seem to work as it is unable to pull any artifacts from custom repositories.

I've tried locally to run mvn -B release:prepare release:perform (after deleting my ~/.m2/repository) with the exact same settings.xml generated by s4u/maven-settings-action, no <repositories> section in my pom.xml and it works fine.

Any ideas how I could get this to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions