Build jar from maven project on github

I couldn't find any tutorials on how to do this. i have a project in java version 21 at https://github.com/asdru22/JavaGame/ if i try and use github actions i get an error when it tries to update the dependency graphs.
No description
23 Replies
JavaBot
JavaBot8mo ago
This post has been reserved for your question.
Hey @asdru! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
asdru
asdruOP8mo ago
https://github.com/asdru22/JavaGame/blob/main/.github/workflows/maven.yml this file was a template from github, i just changed the versions to 21
szatkus
szatkus8mo ago
Maybe use a more recent version?
- name: Submit Dependency Snapshot uses: advanced-security/maven-dependency-submission-action@v3
dan1st
dan1st8mo ago
there's also v4
asdru
asdruOP8mo ago
i tried setting the version to 4 but i still get some erorrs Error: TypeError: Cannot read properties of undefined (reading 'forEach') Error: Error: Could not generate a snapshot of the dependencies; Cannot read properties of undefined (reading 'forEach') Error: Failed to generate a dependency snapshot, check logs for more details, Error: Could not generate a snapshot of the dependencies; Cannot read properties of undefined (reading 'forEach')
dan1st
dan1st8mo ago
Can you show where this happens with v4? oh you set the wrong thing to v4 the last line is uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
asdru
asdruOP8mo ago
is there a particular order where i need to put this? i put it under the "build with maven" part
dan1st
dan1st8mo ago
that should be uses: advanced-security/maven-dependency-submission-action@v4
dan1st
dan1st8mo ago
GitHub
JavaGame/.github/workflows/maven.yml at f7561fad216b2268f15c7354036...
Onest no idea. Contribute to asdru22/JavaGame development by creating an account on GitHub.
JavaBot
JavaBot8mo ago
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
asdru
asdruOP8mo ago
ooh i see let me try
asdru
asdruOP8mo ago
i get this error with the updated .yaml
No description
dan1st
dan1st8mo ago
I think you might need to set permissions
asdru
asdruOP8mo ago
Chris Patterson
The GitHub Blog
GitHub Actions improvements for fork and pull request workflows
Today GitHub Actions shipped a series of features designed to improve your workflows when working with PRs from repository forks. New settings for private repository forks Many GitHub customers choose to work in a forking model instead of a branching model with their private repositories. Until now, users were not able to run workflows on […]
dan1st
dan1st8mo ago
make sure to set the permission contents:write
asdru
asdruOP8mo ago
unless i have enterprise or org repositories
dan1st
dan1st8mo ago
I think you need to add
permissions:
contents: write
permissions:
contents: write
probably at the top somewhere outside of the jobs actually no inside your job probably something like
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
asdru
asdruOP8mo ago
yeaah it works apologies for the stupid question, but does this mean that there is the built jar downloadable somewhere?
dan1st
dan1st8mo ago
no If you want that, you'd need to - create the JAR - upload it which can be done in GitHub Actions you are even already creating it in your workflow but not uploading
asdru
asdruOP8mo ago
ah i see i found the documentation i'll try and see if i can do that
JavaBot
JavaBot8mo ago
Post Closed
This post has been closed by <@372715536121069578>.

Did you find this page helpful?