小编Dmi*_*ets的帖子

在 Maven 中配置 hibernate-jpamodelgen

我想配置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>
Run Code Online (Sandbox Code Playgroud)

完整 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' …
Run Code Online (Sandbox Code Playgroud)

java hibernate maven

5
推荐指数
2
解决办法
2万
查看次数

Liquibase 无法启动,因为在“迁移文件:类路径”中找不到更改日志

当我启动应用程序时,它失败并显示以下消息,指出更改日志文件的类路径不存在:

Description:

Liquibase failed to start because no changelog could be found at 'Migration File: class path resource [db/changelog/dbchangelog.xml] cannot be resolved to URL because it does not exist'.

Action:

Make sure a Liquibase changelog is present at the configured path.
Run Code Online (Sandbox Code Playgroud)

看起来我有正确的类路径,application.yaml所以我不知道为什么它说它不存在。

Hee 是类路径application.yaml

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/db_product
    username: user
    password: password
    driver-class-name: com.mysql.cj.jdbc.Driver
  jpa:
    hibernate.ddl-auto: none
    database-platform: org.hibernate.dialect.MySQLDialect
    show-sql: true
  liquibase:
    change-log: classpath:db/changelog/dbchangelog.xml
    enabled: true
Run Code Online (Sandbox Code Playgroud)

项目结构:

在此输入图像描述

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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> …
Run Code Online (Sandbox Code Playgroud)

liquibase maven spring-boot

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

maven ×2

hibernate ×1

java ×1

liquibase ×1

spring-boot ×1