gpt4 book ai didi

java - 在 Maven 中配置 hibernate-jpamodelgen

转载 作者:行者123 更新时间:2023-12-02 01:23:33 24 4
gpt4 key购买 nike

我想将 hibernate-jpamodelgen 配置到 Maven pom.xml 中。我试过这个:

<?xml version="1.0" encoding="UTF-8"?>
<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>plugin</groupId>
<artifactId>org.plugin</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>Plugin</name>
<url>http://maven.apache.org</url>

<parent>
........
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.3.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>datalis_plugin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>10</source>
<target>10</target>
<encoding>${project.build.sourceEncoding}</encoding>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
</path>
</annotationProcessorPaths>
<compilerArguments>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

完整 POM:https://pastebin.com/VjucMAYL

但是我收到错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project org.plugin: Compilation failure
[ERROR] Annotation processor 'org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor' not found

你知道我该如何解决这个问题吗?

我用过这个:https://docs.jboss.org/hibernate/jpamodelgen/1.0/reference/en-US/html_single/

最佳答案

我通常只是将 hibernate-jpamodelgen 添加到编译器插件的注释处理器路径中。这会阻止处理器打包到部署中。

 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.3.Final</version>
</path>
</annotationProcessorPaths>

</configuration>
</plugin>

关于java - 在 Maven 中配置 hibernate-jpamodelgen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57290897/

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