Igo*_*eld 5 java maven multi-module jenkins
最近我们尝试使用 jenkins 来部署文件${revision},为构建提供属性(Maven 3.3.9)。它在0.0.1-SNAPSHOT为开发构建和0.0.1-RC发布创建 json 时工作正常,但我们在开发人员机器上使用 maven 时遇到问题。我们有一个多模块 maven 项目,其版本定义在 parent 中,一些模块使用其他模块作为依赖项。两者都从 jenkins 构建它并在本地使用 maven,在将其推送到存储库之前与 IDE 集成并运行测试。当我们尝试构建单个模块时,maven 无法识别${revision},尽管当我们提到所有模块时它工作正常,例如mvn clean install -pl appserver,我们看到
Failed to execute goal on project appserver: Could not resolve dependencies for project com.org:appserver:war:0.0.1-local: Failed to collect dependencies at com.org:my-kinesis-events:jar:0.0.1-local: Failed to read artifact descriptor for com.org:my-kinesis-events:jar:0.0.1-local: Could not transfer artifact com.org:my-parent:pom:${revision} from/to central: Failed to transfer .../repository/maven-central/com/org/my-parent/${revision}/my-parent-${revision}.pom. Error code 500, Server Error -> [Help 1]
我们尝试使用:
-Drevision=0.0.1-local
<profile>
<id>default-version</id>
<activation>
<property>
<name>!revision</name>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<revision>0.0.1-local</revision>
<project.version>0.0.1-local</project.version>
</properties>
</profile>
但唯一有效的是为构建模块及其依赖的所有模块的父级构建:
mvn clean install -pl appserver,my-kinesis-events,module1,module2,...
虽然上述工作需要团队在 IDE 中定义自定义运行配置,但每次他们需要一些东西时。
有人也遇到过这个问题并找到了解决方案吗?
父 pom 片段:
<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>
<groupId>com.org</groupId>
<artifactId>my-parent</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<name>My Parent module</name>
<modules>
<module>../my-tools</module>
<module>my-kinesis-events</module>
....
</modules>
.....
</project>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>my.org</groupId>
<artifactId>my-kinesis-events<</artifactId>
<version>${project.version}</version>
<dependency>
<dependencies>
</dependencyManagement>
模块 pom 片段:
<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>appServer</artifactId>
<parent>
<groupId>com.org</groupId>
<artifactId>my-dsp</artifactId>
<version>${revision}</version>
<relativePath>..</relativePath>
</parent>
<packaging>war</packaging>
<name>AppServerAPI</name>
<description>Application Server</description>
<dependencies>
<dependency>
<groupId>com.org</groupId>
<artifactId>my-openrtb</artifactId>
</dependency>
.....
</dependencies>
....
</project>
| 归档时间: |
|
| 查看次数: |
8192 次 |
| 最近记录: |