在 Maven 目标和 Maven 存储库中找到 Liquibase 资源
Liquibase resource found in both Maven target and Maven repository
我有 Eclipse Maven GWT 项目,我添加了 flowable-form-engine
使用 Liquibase 的依赖项。 Liquibase 正在搜索更新日志文件 org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
,但找到了两个!
org.flowable.common.engine.api.FlowableException: Error initialising form data schema
at org.flowable.form.engine.impl.db.FormDbSchemaManager.initSchema(FormDbSchemaManager.java:58)
at org.flowable.form.engine.impl.cmd.SchemaOperationsFormEngineBuild.execute(SchemaOperationsFormEngineBuild.java:29)
at org.flowable.form.engine.impl.cmd.SchemaOperationsFormEngineBuild.execute(SchemaOperationsFormEngineBuild.java:24)
at org.flowable.common.engine.impl.interceptor.DefaultCommandInvoker.execute(DefaultCommandInvoker.java:10)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:71)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.form.engine.impl.FormEngineImpl.<init>(FormEngineImpl.java:45)
at org.flowable.form.engine.FormEngineConfiguration.buildFormEngine(FormEngineConfiguration.java:172)
at org.flowable.form.engine.configurator.FormEngineConfigurator.initFormEngine(FormEngineConfigurator.java:83)
at org.flowable.form.engine.configurator.FormEngineConfigurator.configure(FormEngineConfigurator.java:63)
at org.flowable.common.engine.impl.AbstractEngineConfiguration.configuratorsAfterInit(AbstractEngineConfiguration.java:859)
at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:985)
at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:887)
at sk.dominanz.coarui.server.services.WorkflowServiceAdditional.<clinit>(WorkflowServiceAdditional.java:64)
... 33 more
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:118)
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.Liquibase.update(Liquibase.java:175)
at liquibase.Liquibase.update(Liquibase.java:168)
at org.flowable.form.engine.impl.db.FormDbSchemaManager.initSchema(FormDbSchemaManager.java:52)
... 48 more
Caused by: java.io.IOException: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:206)
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:71)
... 55 more
所以我调试了它,它从目标目录中找到了一个资源:
jar:file:/C:/work/git/coarui/target/Main-1.0-SNAPSHOT/WEB-INF/lib/flowable-form-engine-6.4.0.jar!/org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
和 Maven 存储库中的其他资源:
jar:file:/C:/Users/Piro/.m2/repository/org/flowable/flowable-form-engine/6.4.0/flowable-form-engine-6.4.0.jar!/org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
有没有办法忽略其中之一,或者我的构建路径或依赖项定义有误?
我的构建路径包含:
- src/main/java 来源
- src/test/java 来源
- JRE 系统库
- Maven 依赖项(在 C:/Users/Piro/.m2/repository...)
- JUnit4
看源码资源是阅读classLoader.getResources(path);
其中classloader是jettyclassloaderJettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension
.
在我的 run/debug 配置中,我有 class 类似于构建路径加上 GWT 库的路径 gwt-dev-2.8.1.jar - C:\Users\Piro\.m2\repository\com\google\gwt\gwt-dev.8.1
在pom.xml
中依赖定义为:
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-form-engine-configurator</artifactId>
<version>${flowableVersion}</version>
</dependency>
Maven GWT 插件 groupId=net.ltgt.gwt.maven, artifactId=gwt-maven-plugin
具有配置参数 classpathScope
但我测试了 <classpathScope>compile+runtime</classpathScope>
、<classpathScope>compile</classpathScope>
和 <classpathScope>runtime</classpathScope>
并且出现了相同的错误。
当您在同一个 Maven 模块中混合客户端和服务器代码时,通常会发生这种情况,并且考虑到 GWT 的工作方式,除了将您的代码拆分到单独的客户端和服务器(并且可能共享)Maven 模块之外,没有(容易)解决这个问题.
您可以查看 https://github.com/tbroyer/gwt-maven-archetypes 中的示例(免责声明:我是作者,也是 GWT 指导委员会的成员)
似乎出于某种原因您的 .m2
在类路径中。如果它对您来说确实有意义,那么您可以尝试在声明对 flowable-form-engine-configurator
的依赖项的 pom 中使用 <scope>provided</scope>
。但是,您可以决定从类路径中排除 .m2
,我认为这更好。
我有 Eclipse Maven GWT 项目,我添加了 flowable-form-engine
使用 Liquibase 的依赖项。 Liquibase 正在搜索更新日志文件 org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
,但找到了两个!
org.flowable.common.engine.api.FlowableException: Error initialising form data schema
at org.flowable.form.engine.impl.db.FormDbSchemaManager.initSchema(FormDbSchemaManager.java:58)
at org.flowable.form.engine.impl.cmd.SchemaOperationsFormEngineBuild.execute(SchemaOperationsFormEngineBuild.java:29)
at org.flowable.form.engine.impl.cmd.SchemaOperationsFormEngineBuild.execute(SchemaOperationsFormEngineBuild.java:24)
at org.flowable.common.engine.impl.interceptor.DefaultCommandInvoker.execute(DefaultCommandInvoker.java:10)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:71)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.form.engine.impl.FormEngineImpl.<init>(FormEngineImpl.java:45)
at org.flowable.form.engine.FormEngineConfiguration.buildFormEngine(FormEngineConfiguration.java:172)
at org.flowable.form.engine.configurator.FormEngineConfigurator.initFormEngine(FormEngineConfigurator.java:83)
at org.flowable.form.engine.configurator.FormEngineConfigurator.configure(FormEngineConfigurator.java:63)
at org.flowable.common.engine.impl.AbstractEngineConfiguration.configuratorsAfterInit(AbstractEngineConfiguration.java:859)
at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:985)
at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:887)
at sk.dominanz.coarui.server.services.WorkflowServiceAdditional.<clinit>(WorkflowServiceAdditional.java:64)
... 33 more
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:118)
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.Liquibase.update(Liquibase.java:175)
at liquibase.Liquibase.update(Liquibase.java:168)
at org.flowable.form.engine.impl.db.FormDbSchemaManager.initSchema(FormDbSchemaManager.java:52)
... 48 more
Caused by: java.io.IOException: Found 2 files that match org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:206)
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:71)
... 55 more
所以我调试了它,它从目标目录中找到了一个资源:
jar:file:/C:/work/git/coarui/target/Main-1.0-SNAPSHOT/WEB-INF/lib/flowable-form-engine-6.4.0.jar!/org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
和 Maven 存储库中的其他资源:
jar:file:/C:/Users/Piro/.m2/repository/org/flowable/flowable-form-engine/6.4.0/flowable-form-engine-6.4.0.jar!/org/flowable/form/db/liquibase/flowable-form-db-changelog.xml
有没有办法忽略其中之一,或者我的构建路径或依赖项定义有误?
我的构建路径包含:
- src/main/java 来源
- src/test/java 来源
- JRE 系统库
- Maven 依赖项(在 C:/Users/Piro/.m2/repository...)
- JUnit4
看源码资源是阅读classLoader.getResources(path);
其中classloader是jettyclassloaderJettyLauncher$WebAppContextWithReload$WebAppClassLoaderExtension
.
在我的 run/debug 配置中,我有 class 类似于构建路径加上 GWT 库的路径 gwt-dev-2.8.1.jar - C:\Users\Piro\.m2\repository\com\google\gwt\gwt-dev.8.1
在pom.xml
中依赖定义为:
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-form-engine-configurator</artifactId>
<version>${flowableVersion}</version>
</dependency>
Maven GWT 插件 groupId=net.ltgt.gwt.maven, artifactId=gwt-maven-plugin
具有配置参数 classpathScope
但我测试了 <classpathScope>compile+runtime</classpathScope>
、<classpathScope>compile</classpathScope>
和 <classpathScope>runtime</classpathScope>
并且出现了相同的错误。
当您在同一个 Maven 模块中混合客户端和服务器代码时,通常会发生这种情况,并且考虑到 GWT 的工作方式,除了将您的代码拆分到单独的客户端和服务器(并且可能共享)Maven 模块之外,没有(容易)解决这个问题.
您可以查看 https://github.com/tbroyer/gwt-maven-archetypes 中的示例(免责声明:我是作者,也是 GWT 指导委员会的成员)
似乎出于某种原因您的 .m2
在类路径中。如果它对您来说确实有意义,那么您可以尝试在声明对 flowable-form-engine-configurator
的依赖项的 pom 中使用 <scope>provided</scope>
。但是,您可以决定从类路径中排除 .m2
,我认为这更好。