Java 如何从Github包中获取maven插件?
我已成功地将java包部署到Github包中,我尝试将其作为依赖项成功地使用:Java 如何从Github包中获取maven插件?,java,maven,github,github-actions,github-package-registry,Java,Maven,Github,Github Actions,Github Package Registry,我已成功地将java包部署到Github包中,我尝试将其作为依赖项成功地使用: <dependency> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> 另外,.m2/settings.xlm已经
<dependency>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
另外,.m2/settings.xlm
已经准备好,可以正常工作,因为我通过将包作为依赖项而不是插件获取来测试它,它包含:
<server>
<id>github</id>
<username>USER</username>
<password>PERSONAL_TOKEN_SCOPE_REPO_W_R_PACKAGES</password>
</server>
<profile>
<id>github</id>
<repositories>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/OWNER/REPO-NAME</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<updatePolicy>always</updatePolicy>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
github
使用者
个人\u代币\u范围\u回购\u W\u R\u包
github
github
GitHub所有者ApacheMaven包
https://maven.pkg.github.com/OWNER/REPO-NAME
真的
总是
真的
github
有什么想法吗?提前感谢我找到了如何正确配置它的方法 您可以看到一个示例项目,其中包含工作的GitHub操作CI和GitHub包注册表: 要查看如何包含依赖项,请检查:
尤里卡!对于获取插件,我们应该使用
而不是用于获取依赖项的
记住:pluginRepositories包含与远程存储库建立连接所需的信息
我的设置是正确的,我只需要在
中添加此部分:
github
GitHub所有者ApacheMaven包
https://maven.pkg.github.com/OWNER/REPO-NAME
真的
总是
真的
请参阅示例
~/.m2/settings.xml
谢谢@boetis。我注意到您的意思是“依赖项”而不是“插件”,因为我成功地获取了依赖项,但无法将包作为插件获取。我理解你了吗?是的,对不起。我犯了一个错误。如果我的答案对你有帮助,请勾选它并投票,这样它可以帮助社区。不幸的是,你的答案非常适合获取依赖项,但不是我需要的插件。我的问题不是身份验证问题,正如我说过的,我通过从同一个repo获取依赖关系测试了我的标记,测试成功了,用户作为所有者,密码作为scopes repo+包(w/r)的令牌。再次您好,非常感谢您的帮助。我把我的解决方案贴了下来,也许你想检查一下。祝您有个美好的一天。
Plugin com.example:demo:1.0.0-SNAPSHOT or one of its dependencies could not be resolved:
Could not find artifact com.example:demo:1.0.0-SNAPSHOT -> [Help 1]
<server>
<id>github</id>
<username>USER</username>
<password>PERSONAL_TOKEN_SCOPE_REPO_W_R_PACKAGES</password>
</server>
<profile>
<id>github</id>
<repositories>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/OWNER/REPO-NAME</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<updatePolicy>always</updatePolicy>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>