Maven profile处于活动状态,但什么都不做-为什么?
我们有一个公司母公司POM,它定义了如何构建项目。我们还购买了一个产品(可视规则),它需要一个完全独立的构建,并带有完全独立的插件 因此,自然的解决方案是使用Maven配置文件。但是,可视化规则插件不会检查它们是针对POM还是针对模块执行的。这意味着简单地激活概要文件(Maven profile处于活动状态,但什么都不做-为什么?,maven,maven-profiles,visualrules,Maven,Maven Profiles,Visualrules,我们有一个公司母公司POM,它定义了如何构建项目。我们还购买了一个产品(可视规则),它需要一个完全独立的构建,并带有完全独立的插件 因此,自然的解决方案是使用Maven配置文件。但是,可视化规则插件不会检查它们是针对POM还是针对模块执行的。这意味着简单地激活概要文件(-pvisualrules,在我的例子中)将使构建失败,因为插件查找特定的文件,这些文件不存在于父项目中,只存在于模块中 公司母公司POM中的配置文件如下所示: <profile> <id>visual
-pvisualrules
,在我的例子中)将使构建失败,因为插件查找特定的文件,这些文件不存在于父项目中,只存在于模块中
公司母公司POM中的配置文件如下所示:
<profile>
<id>visual-rules</id>
<build>
<plugins>
<plugin>
<groupId>de.visualrules.builder</groupId>
<artifactId>visualrules-validation-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin>
...and other Visual Rules plugins
</plugins>
</build>
</profile>
使用mvn帮助:活动配置文件清理包
我现在获得以下输出:
10:10:31.788 [INFO] --- maven-help-plugin:3.1.0:active-profiles (default-cli) @ global-regeln ---
10:10:32.080 [INFO]
Active Profiles for Project 'foobar:global-regeln:pom:1.21.0-SNAPSHOT':
The following profiles are active:
- default (source: external)
- local (source: foobar:corporate-parent:1.52.0-SNAPSHOT)
Active Profiles for Project 'foobar:global-regeln-edossier-schlagwort-zu-doktyp:jar:1.21.0-SNAPSHOT':
The following profiles are active:
- default (source: external)
- visual-rules (source: foobar:global-regeln:1.21.0-SNAPSHOT)
- local (source: foobar:corporate-parent:1.52.0-SNAPSHOT)
Active Profiles for Project 'foobar:global-regeln-zahlungspflichtdatum-fuer-gebuehrtyp:jar:1.21.0-SNAPSHOT':
The following profiles are active:
- default (source: external)
- visual-rules (source: foobar:global-regeln:1.21.0-SNAPSHOT)
- local (source: foobar:corporate-parent:1.52.0-SNAPSHOT)
Active Profiles for Project 'foobar:global-regeln-fristberechnung:jar:1.21.0-SNAPSHOT':
The following profiles are active:
- default (source: external)
- visual-rules (source: foobar:global-regeln:1.21.0-SNAPSHOT)
- local (source: foobar:corporate-parent:1.52.0-SNAPSHOT)
Active Profiles for Project 'foobar:global-regeln-terminberechnung:jar:1.21.0-SNAPSHOT':
The following profiles are active:
- default (source: external)
- visual-rules (source: foobar:global-regeln:1.21.0-SNAPSHOT)
- local (source: foobar:corporate-parent:1.52.0-SNAPSHOT)
... Rest of the build, no Visual Rules plugin output!
但是,尽管可视规则
配置文件显示为活动,但配置文件中的插件没有启动-为什么
为了确保这一点,我还使用mvn帮助:activeprofiles clean-package-pvisualrules
启动了构建,在这里启动了插件并导致了上述问题
10:18:50.608 [INFO] ------------------------------------------------------------------------
10:18:50.608 [INFO] Reactor Summary:
10:18:50.608 [INFO]
10:18:50.608 [INFO] Globale Regeln ..................................... FAILURE [ 3.414 s]
10:18:50.608 [INFO] eDossierregeln-Schlagworte zu Dokumententypen ...... SKIPPED
10:18:50.608 [INFO] Globale Zahlungspflichtdatumberechnung-Regel ....... SKIPPED
10:18:50.608 [INFO] Globale Fristberechnung ............................ SKIPPED
10:18:50.608 [INFO] Globale Terminberechnung ........................... SKIPPED
10:18:50.608 [INFO] ------------------------------------------------------------------------
10:18:50.608 [INFO] BUILD FAILURE
10:18:50.608 [INFO] ------------------------------------------------------------------------
10:18:50.608 [INFO] Total time: 5.515 s
10:18:50.608 [INFO] Finished at: 2019-02-28T10:18:50+01:00
10:18:50.801 [INFO] Final Memory: 72M/793M
10:18:50.801 [INFO] ------------------------------------------------------------------------
10:18:50.803 [ERROR] Failed to execute goal de.visualrules.builder:visualrules-validation-maven-plugin:6.4.10:validate (default) on project global-regeln: RuleModel 'global-regeln-edossier-schlagwort-zu-doktyp' is not valid: Referenziertes Element "allgemein-regeln-fachdaten" nicht gefunden
也许我真的不理解Maven配置文件的激活,但这对我来说似乎很奇怪。。。非常感谢您的帮助 它看起来像是用相同的ID定义配置文件,并且激活覆盖了公司母公司POM中的配置文件。由于模块中的配置文件不包含任何内容,因此该配置文件显示为活动,但不启动任何插件 因此,最后我做了以下几点: 在公司母公司POM中,我更改了配置文件
视觉规则
:
<profile>
<id>visual-rules</id>
<activation>
<file>
<!-- Every Visual Rules module must have this dummy file in the root directory. -->
<exists>build-visual-rules</exists>
</file>
</activation>
<build>
... Plugins etc.
</build>
</profile>
视觉规则
构建可视化规则
... 插件等。
因此,每个想要激活此配置文件的模块都需要在其根目录(POM文件旁边)中有一个虚拟文件
构建可视规则。它看起来像是用相同的ID定义配置文件,激活覆盖公司父POM中的配置文件。由于模块中的配置文件不包含任何内容,因此该配置文件显示为活动,但不启动任何插件
因此,最后我做了以下几点:
在公司母公司POM中,我更改了配置文件视觉规则
:
<profile>
<id>visual-rules</id>
<activation>
<file>
<!-- Every Visual Rules module must have this dummy file in the root directory. -->
<exists>build-visual-rules</exists>
</file>
</activation>
<build>
... Plugins etc.
</build>
</profile>
视觉规则
构建可视化规则
... 插件等。
因此,每个想要激活此配置文件的模块都需要在其根目录(POM文件旁边)中有一个虚拟文件build visual rule
。mvn clean package-p visual rules
您缺少一个空间。试试添加的那个,看看它是否有效谢谢,但结果是一样的。找不到RuleModel引用的元素“general rules data”。看起来maven正在尝试查找general rules data是的,这是可视化规则在起作用。。。但是,可视化规则插件不应为父项目执行。因此,基本上您希望跳过其中包含可视化规则文件的模块(参考资料)?如果有错误,请更正。mvn clean package-P视觉规则
您缺少一个空间。试试添加的那个,看看它是否有效谢谢,但结果是一样的。找不到RuleModel引用的元素“general rules data”。看起来maven正在尝试查找general rules data是的,这是可视化规则在起作用。。。但是,可视化规则插件不应为父项目执行。因此,基本上您希望跳过其中包含可视化规则文件的模块(参考资料)?错了就纠正我。