Hy jHipsters,
当我在下面定义的@manyToMany关系上运行mvn命令行liquibase:diff时,我有一个空指针异常
class user.java
@JsonIgnore
@ManyToMany
@JoinTable(name = "USER_PROJECT",
joinColumns = {@JoinColumn(name="user_id", referencedColumnName="id")},
inverseJoinColumns = {@JoinColumn(name="project_id", referencedColumnName="id")})
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Project> projects = new HashSet<>();
类project.java
@ManyToMany(mappedBy = "projects")
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<User> users = new HashSet<>();
堆栈跟踪:
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.3.2:diff (default-cli) on project app: Error setting up or running Liquibase: liquibase.command.CommandExecutionException: java.lang.NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:3.3.2:diff (default-cli) on project app: Error setting up or running Liquibase: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error setting up or running Liquibase: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:373)
at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute(LiquibaseDatabaseDiff.java:145)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:123)
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:100)
at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask(LiquibaseDatabaseDiff.java:176)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:369)
... 23 more
Caused by: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:121)
... 26 more
Caused by: java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
at java.util.regex.Matcher.reset(Matcher.java:309)
at java.util.regex.Matcher.<init>(Matcher.java:229)
at java.util.regex.Pattern.matcher(Pattern.java:1093)
at liquibase.diff.output.StandardObjectChangeFilter$Filter.matches(StandardObjectChangeFilter.java:104)
at liquibase.diff.output.StandardObjectChangeFilter.include(StandardObjectChangeFilter.java:70)
at liquibase.diff.output.StandardObjectChangeFilter.includeMissing(StandardObjectChangeFilter.java:51)
at liquibase.diff.output.changelog.ChangeGeneratorChain.fixMissing(ChangeGeneratorChain.java:28)
at liquibase.diff.output.changelog.ChangeGeneratorFactory.fixMissing(ChangeGeneratorFactory.java:99)
at liquibase.diff.output.changelog.DiffToChangeLog.generateChangeSets(DiffToChangeLog.java:145)
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:125)
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:76)
at liquibase.diff.output.changelog.DiffToChangeLog.print(DiffToChangeLog.java:64)
at liquibase.command.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:61)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)
... 27 more
谢谢你的帮助!
答案 0 :(得分:1)
警告不是清洁溶液,有些副作用。无论如何我都会分享它以防万一。
我成功地将liquibase版本从3.3.2降级到3.3.1。以下是更多详情:
<liquibase-hibernate4.version>3.5</liquibase-hibernate4.version>
<liquibase-slf4j.version>1.2.1</liquibase-slf4j.version>
<liquibase.version>3.3.1</liquibase.version>
liquibase:diff运行时没有错误,并使用我的模型更改创建更改日志但是它包含我的Oauth2数据库表的drop table指令。
似乎liquibase插件配置中的diffExcludeObjects被忽略或不适用于版本3.3.1。
类似问题的一些相关链接: