【发布时间】:2021-04-27 00:26:45
【问题描述】:
这似乎应该是一个简单的问题,但我似乎找不到任何有关它的信息。当 maven 插件具有必需的依赖项时,是否可以告诉它使用 pom 部分中其他地方定义的工件?
例如,我正在尝试将“maven-processor-plugin”添加到我的构建中。该插件依赖于“hibernate-jpamodelgen”。我正在使用wildfly,所以我已经将该jar 作为项目的依赖项。我想确保我对两者都使用相同的版本。我正在尝试做的事情是否可能?
一些代码sn-ps:
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb3</artifactId>
<version>${version.server.bom}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArguments>
<processor>-proc:none</processor>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>4.5</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/java/jpametamodel</outputDirectory>
<processors>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</processors>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<!-- How do I handle this without hard coding the version? -->
<!-- <version>???</version> -->
</dependency>
</dependencies>
</plugin>
</build>
【问题讨论】:
标签: maven plugins dependencies version wildfly