我在使用Github动作时有些挣扎。
我正在尝试使用Github动作与Maven一起构建项目。该项目包含一个依赖关系,该依赖关系位于同一组织内的存储库中。
我创建了具有读/写权限的PAT,并编写了以下脚本:
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# Added personal token
name: Maven Deploy
on:
push:
branches: develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: github
- name: Build with Maven
run: mvn -B package --file DynamoDB\ Service/pom.xml
env:
MENADEX_USERNAME: my_username
MENADEX_TOKEN: xxxxxxxxxxxxx
- name: Publish package
run: mvn deploy -f DynamoDB\ Service/pom.xml -s $GITHUB_WORKSPACE/DynamoDB\ Service/settings.xml
env:
MENADEX_USERNAME: my_username
MENADEX_TOKEN: xxxxxxxxxxxxxxxxxxxxxx
Github一直抱怨找不到与依赖项有关的工件。
Settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
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">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>Common</id>
<name>GitHub Menadex Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Menadex/Ad360CommonObjects</url>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>github</id>
<username>${env.MENADEX_USERNAME}</username>
<password>${env.MENADEX_TOKEN}</password>
</server>
</servers>
</settings>
这是我一直收到的:
[ERROR] Failed to execute goal on project dynamodb: Could not resolve dependencies for project com.ad360:dynamodb:jar:1.0.0-SNAPSHOT: Could not find artifact com.ad360:common:jar:1.0.0-SNAPSHOT -> [Help 1]
210
[ERROR]
211
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
212
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
213
[ERROR]
214
[ERROR] For more information about the errors and possible solutions, please read the following articles:
215
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
216
##[error]Process completed with exit code 1.
此外,我看到从未触摸过新创建的PAT。 (在管理部分中,它说“从未使用过”。)