原来的问题
我正在尝试将我的系统部署自动化到我的网站,但我需要知道该 Artifact 的实际名称。我正在使用 Github Pages,因此我没有后端脚本来搜索文件扩展名、名称字符串包含等。
我计划的解决方案
我将创建一个 Maven 插件,并在构建过程中导出最终的 Artifact 名称。
其他遇到的问题
为了实现我的解决方案,我必须在构建生命周期中访问占位符。但是,我找不到任何有关这样做的资源。
TL;DR;
如何从 Maven 插件访问 Maven 构建生命周期占位符?
最佳答案
您不必开发自己的插件来将项目部署到...任何地方。您可以使用 Wagon Maven Plugin :
It allows you to upload resources from your build to a remote location using wagon.
参见Maven Wagon对于支持的传输。
在其<configuration>
内您可以使用 <includes>**/${project.build.finalName}*</includes>
(默认值: ${artifactId}-${version}
)它是 the build
element 的元素。请注意:
The term "finalName" is kind of a misnomer, [...]. For example, if the
maven-jar-plugin
is configured to give a jar aclassifier
oftest
, then the actual jar defined above will be built asmy-project-1.0-test.jar
.
关于java - 如何从 Maven 插件访问 Maven 占位符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55633407/