[英]Maven pom plugin not executing on build
I'm practicing Maven and I've hit a wall. 我正在练习Maven,但碰壁了。 I've installed the PlantUml plugin on IntelliJ and I'm trying to set it up so that it always generates a new image from the source file on compile time.
我已经在IntelliJ上安装了PlantUml插件,并且试图对其进行设置,以使其始终在编译时从源文件生成新图像。 I'm using this plugin to generate the image, and I've configured the pom.xml file as follows:
我正在使用此插件生成图像,并且已按如下所示配置pom.xml文件:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.jeluard</groupId>
<artifactId>plantuml-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>GeneratePlantUml</id>
<phase>generate-resources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/images</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<sourceFiles>
<directory>${basedir}/plantuml</directory>
<includes>
<include>TestGeneratorDiagram.puml</include>
</includes>
</sourceFiles>
<outputDirectory>${basedir}/images</outputDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>8031</version>
</dependency>
</dependencies>
</plugin>
<plugins>
</pluginManagement>
<build>
This works fine when I use a terminal command where I specify the goal: 当我在指定目标的地方使用终端命令时,这可以正常工作:
mvn compile com.github.jeluard:plantuml-maven-plugin:generate
However, it doesn't work if I just write: 但是,如果我只写:
mvn compile
Which, as far as I know, should also work. 据我所知,这也应该起作用。 I've tried setting the phase on compile but it didn't change anything.
我尝试将阶段设置为编译,但没有任何改变。 I've searched for hours now for a solution but I haven't found one.
我已经搜索了数小时以寻找解决方案,但没有找到解决方案。 Does anyone know how I can force the plugin to generate a new image on compile time by configuring the pom?
有谁知道我如何通过配置pom强制插件在编译时生成新映像?
You have put your configuration into pluginManagement
. 您已将配置放入
pluginManagement
。 You needs to put it into plugins
( outside pluginManagement
). 您需要将其放入
plugins
( 在 pluginManagement
之外 )。
The pluginManagement is just to override/specify configuration and version numbers. pluginManagement仅用于覆盖/指定配置和版本号。
Have a look at Maven: What is pluginManagement? 看看Maven:什么是pluginManagement?
your plugin and your execution is configure à the "generate-resources" phase and not at the compile phase like you want. 您的插件和执行是在“ generate-resources”阶段配置的,而不是您想要的编译阶段。 See this link to more detail on phase.
有关此阶段的更多详细信息,请参见此链接 。
change this: 改变这个:
<execution>
<id>GeneratePlantUml</id>
<phase>generate-resources</phase>
<goals>
<goal>generate</goal>
</goals>
to this 对此
<execution>
<id>GeneratePlantUml</id>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
It must works. 它必须工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.