gpt4 book ai didi

java - Maven 使用 pomIninclude

转载 作者:行者123 更新时间:2023-12-02 09:43:13 24 4
gpt4 key购买 nike

我是 Maven 的新手,并且被困在 this tutorial 上。 .

有一个元素 pomInclude 用于包含另一个 POM 文件。当我使用命令构建bus-core-api时

mvn package -U

它仅适用于当前项目。其他的在构建过程中不会被调用。

bus-core-api 中的 pom.xml:

<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>bus-core-api</groupId>
<artifactId>bus-core-api</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.6</version>
<configuration>
<debug>true</debug>
<pomIncludes>
<pomInclude>app-web-ui/pom.xml</pomInclude>
<pomInclude>app-desktop-ui/pom.xml</pomInclude>
</pomIncludes>
</configuration>
<executions>
<execution>
<id>build</id>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

部分输出:

[INFO] 将 1 个源文件编译到 c:\apache-maven-3.3.3\bus-core-api\target\clas
ses

其他人失踪了。你能告诉我为什么吗?

最佳答案

pomIncludes是配置 maven-invoker-plugin 的元素。引用文档,该参数用于:

Include patterns for searching the integration test directory for projects.

这意味着在项目集成测试期间,Maven 将同时运行 app-web-uiapp-desktop-ui 项目并输出结果到命令行。

run该插件的目标默认绑定(bind)到 Maven 阶段integration-test。由于您没有指定阶段,因此它保留默认值。看着lifecyle reference ,您可以看到integration-test 阶段package 阶段之后。因此,当您运行 mvn package 时,Maven 不会执行 integration-test 阶段,因此永远不会调用该插件。

如果您想调用该阶段,可以运行 mvn installmvn verify (或 integration-test 之后的任何阶段) >,包括这个阶段)。

另一个解决方案是在 maven-invoker-plugin 的配置中指定另一个阶段(如 test),但我建议您保留默认值。

关于java - Maven 使用 pomIninclude,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32587910/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com