tim bits
tim bits

Reputation: 37

Maven Workflow Fails to Deploy artifact into Github Packages

I've been trying to publish an artifact into github packages using this guide, but I am getting the following error: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project bughouse-fen-validator: Failed to deploy artifacts: Could not find artifact org.bughouse.fen:bughouse-fen-validator:pom:1.0 in github (https://maven.pkg.github.com/tim-bits/bughouse-fen-validator)

The artifact is obviously created as the following line in the log indicates:[INFO] Installing /home/runner/work/bughouse_fen_validator/bughouse_fen_validator/target/bughouse-fen-validator-1.0.jar to /home/runner/.m2/repository/org/bughouse/fen/bughouse-fen-validator/1.0/bughouse-fen-validator-1.0.jar

Workflow file content is as follows:

name: Maven Package

on:
  push:
    branches:
      - master
  workflow_dispatch:
  release:
    types: [created]

jobs:
  publish:

    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
      deployments: write
    steps:
    - uses: actions/checkout@v4
    - name: Set up JDK 17
      uses: actions/setup-java@v4
      with:
        java-version: '17'
        distribution: 'temurin'

    - name: Publish to GitHub Packages Apache Maven
      run: mvn -X --batch-mode deploy
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Pertaining parts of pom as follows:

    <distributionManagement>
        <repository>
            <id>github</id>
            <name>GitHub Packages</name>
            <url>https://maven.pkg.github.com/tim-bits/bughouse-fen-validator</url>
        </repository>
    </distributionManagement>

    <plugin>
       <artifactId>maven-deploy-plugin</artifactId>
       <version>3.1.1</version>
    </plugin>

Would be grateful for any suggestions.

Upvotes: 0

Views: 47

Answers (0)

Related Questions