我试图在我的多模块项目中使用maven友好ci。我的项目有三个父级子层次结构,即我的父项目几乎没有子项目,而这些子项目中有许多其他子项目。
我在下面添加了我的pom文件的示例。我的父母pom也有一个扁平的插件,在我的本地机器上一切都很好。但当我用詹金斯做的时候,它就没用了。我得到下面的错误
错误
错误在处理POMs:致命的、不可解决的父POM时遇到了一些问题:com.farkan:子模块:未知版本:无法将工件com.Faskan:父-模块:pom:${revision}从/转到连接。
父项目的pom.xml
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.faskan</groupId>
<artifactId>global-parent-dependency</artifactId>
<version>1.1.0</version>
</parent>
<groupId>org.faskan</groupId>
<artifactId>parent-module</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<name>project parent pom</name>
<properties>
<revision>21.15.0-SNAPSHOT</revision>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
...
</project>子项目的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>child-module</artifactId>
<parent>
<groupId>org.faskan</groupId>
<artifactId>parent-module</artifactId>
<version>${revision}</version>
</parent>
<name>child admin</name>
<packaging>jar</packaging>
..
</project>儿童项目(大儿童)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>grand-child-module</artifactId>
<packaging>jar</packaging>
<name>child of child module</name>
<parent>
<groupId>org.faskan</groupId>
<artifactId>child-module</artifactId>
<version>${revision}</version>
</parent>
..
</project>我发现了一个类似的问题,在使用CI友好版本时,如何在Jenkins中构建maven子项目?。不确定我的是否是相同的,因为我没有任何解析失败错误。
发布于 2022-03-12 20:17:15
在您的父pom.xml中缺少扁平插件的以下配置:
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration> 我相信您必须为ci友好项目添加此配置,如这里所解释的那样。
发布于 2021-08-12 15:48:32
在……里面
<parent>
<groupId>org.faskan</groupId>
<artifactId>parent-module</artifactId>
<version>${revision}</version>
</parent>你不能让${revision}为version。梅文不知道从哪里弄来的。你需要使用实际版本。
PS:我不知道你们是如何在当地建造的。
https://stackoverflow.com/questions/68760474
复制相似问题