简体   繁体   English

Jenkins Artifactory Plugin File Specs with subprojects

[英]Jenkins Artifactory Plugin File Specs with subprojects

I am using Jenkins with Artifactory plugin to publish artifacts.我正在使用带有Artifactory 插件的Jenkins 来发布工件。

I build application with Java and Gradle.我使用 Java 和 Gradle 构建应用程序。 Artifacts are located in build/libs/ folder as by convention.按照惯例,工件位于build/libs/文件夹中。 Publishing with specified File Specs works if I have multi module project.如果我有多模块项目,则使用指定的文件规范进行发布。

root
|--proj1
|--proj2
|--...

File Specs pattern looks like (note com.rivancic is group for Artifactory repository):文件规范模式看起来像(注意 com.rivancic 是 Artifactory 存储库的组):

"files": [
  {
    "target": "test-repo/com/rivancic/{1}/1.0.0/{2}-1.0.0{3}",
    "pattern": "/home-dir/com/rivancic/(*)/build/libs/(*)-1.0.0(*)"
  }
]

Here first wildcard is resolved to proj1 or proj2 and artifacts are uploaded to specific modules.这里第一个通配符被解析为proj1proj2并且工件被上传到特定模块。

Problem问题

The problem I face is when using multi module project with nested projects .我面临的问题是在嵌套项目中使用多模块项目时。

root
|--proj1
   |--subproj11
   |--subproj12
|--proj2
|--...

Now with the same pattern for the first subproject11 first wildcard is resolved to proj1/subproj11 instead of only subproj11 .现在,第一个 subproject11 的模式相同,第一个通配符解析为proj1/subproj11而不仅仅是subproj11 This resolves to invalid artifact module name and Artifactory throws exception这将解析为无效的工件模块名称并且 Artifactory 抛出异常

java.lang.RuntimeException: java.io.IOException: Failed to deploy file. Status code: 409 Response message: Artifactory returned the following errors: 
The target deployment path 'com/rivancic/project1/subproject11/1.0.0/subproject11-1.0.0.pom' does not match the POM's expected path prefix 'com/rivancic/subproject11/1.0.0'. Please verify your POM content for correctness and make sure the source path is a valid Maven repository root path. Status code: 409

Is there a way I can define a pattern in File Specs that it will always take just the last part of path, the final subproject instead of the whole path for the above structure有没有一种方法可以在 File Specs 中定义一个模式,它总是只采用路径的最后一部分,即最终的子项目而不是上述结构的整个路径

You can use 2 different File Specs or 2 different File Spec group: One for multi modules and the other for multi projects.您可以使用 2 个不同的文件规范或 2 个不同的文件规范组:一个用于多模块,另一个用于多项目。

For multi projects, use the following exmple:对于多项目,请使用以下示例:

"files": [
  {
    "target": "test-repo/com/rivancic/{1}/1.0.0/{2}-1.0.0{3}",
    "pattern": "/home-dir/com/rivancic/*/(*)/build/libs/(*)-1.0.0(*)"
  }
]

Explanation - In /*/(*) part of the spec, the first asterisk is parsed as a regular wildcard, and the one surrounded by parenthesis, is used as a Placeholder .说明 - 在规范的/*/(*)部分,第一个星号被解析为常规通配符,括号中的星号用作Placeholder

More information about File Specs can be found underUsing File Specs .有关文件规范的更多信息可以在使用文件规范下找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jenkins Artifactory插件忽略了Maven UniqueVersion - Jenkins Artifactory Plugin ignoring Maven UniqueVersion Artifactory Jenkins插件上传的POM文件在Maven版本中无法解析 - POM file Uploaded by Artifactory Jenkins plugin won't resolve in Maven builds 使用Jenkins和maven将WAR文件发布到Artifactory - Using Jenkins and maven to publish a WAR file to Artifactory 使用 Artifactory 插件“包含模式”从 Jenkins 发布项目文件 - Publish project files from Jenkins using Artifactory plugin "Include Patterns" Gradle Artifactory插件不生成Pom文件 - Gradle Artifactory Plugin Not Generating Pom File 使用 Jenkins 将二进制文件与 JAR 文件一起发布到 maven artifactory - Publish binary file to maven artifactory along with JAR files using Jenkins Jenkins Artifactory插件+ Maven Flatten插件+ rtMavenDeployer。 有没有办法部署扁平化的pom文件? - Jenkins Artifactory Plugin + Maven Flatten plugin + rtMavenDeployer. Is there a way to deploy flatten pom files? Jenkins与Artifactory的整合 - Jenkins integration with Artifactory Jenkins无法识别Gradle子项目的测试 - Jenkins doesn't recognize tests of gradle subprojects gradle build with subprojects, git feature branches and jenkins multibranch pipeline: 如何只在受影响的子项目上运行测试 - gradle build with subprojects, git feature branches and jenkins multibranch pipeline: how to only run tests on affected subprojects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM