我正在使用hibernate 3 maven插件使用JPA实体为我的架构生成DDL。一切正常,但插件执行大约需要3-4分钟才能执行。
Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j- nop/1.6.1/slf4j-nop-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[INFO] Executed tasks
我尝试使用-X标志运行maven,以便在打印后输出后看到它被卡住了一段时间。
main:
Class org.hibernate.tool.ant.HibernateToolTask loaded from parent loader (parentFirst)
+Datatype hibernatetool org.hibernate.tool.ant.HibernateToolTask
[mkdir] Created dir: C:\user15273\MySource\Workspace\NewSourceCode\Entity\target\sql\hibernate3
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j-nop/1.6.1/slf4j-nop-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/user15273/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Class org.hibernate.ejb.Ejb3Configuration loaded from parent loader (parentFirst)
Couldn't load ResourceStream for commons-logging.properties
ResourceStream for META-INF/services/org.apache.commons.logging.LogFactory loaded from parent loader
Class org.apache.commons.logging.impl.SLF4JLogFactory loaded from parent loader (parentFirst)
Couldn't load ResourceStream for hibernate.properties
Couldn't load ResourceStream for META-INF/services/javax.xml.parsers.DocumentBuilderFactory
Class com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl loaded from parent loader (parentFirst)
Class com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl loaded from parent loader (parentFirst)
Class com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl loaded from parent loader (parentFirst)
Class com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl loaded from parent loader (parentFirst)
Class com.sun.org.apache.xerces.internal.impl.dv.xs.ExtendedSchemaDVFactoryImpl loaded from parent loader (parentFirst)
Class com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl loaded from parent loader (parentFirst)
Class com.sun.org.apache.xerces.internal.impl.dv.dtd.DTDDVFactoryImpl loaded from parent loader (parentFirst)
Class com.sun.org.apache.xerces.internal.impl.dv.xs.SchemaDVFactoryImpl loaded from parent loader (parentFirst)
有没有人知道如何找出这种延迟的原因或如何解决这个问题? TIA。
答案 0 :(得分:1)
我现在已经解决了这个问题。分析了maven进程的线程转储,发现线程在套接字连接上处于WAITING状态。在更多分析中,我发现xerces类试图下载持久性XSD。
由于我没有使用具有该XSD的Hibernate实体jar版本,因此我不得不手动将XSD放置在项目结构中。现在构建回到几分钟。
答案 1 :(得分:0)
如果依赖项声明,则需要添加排除项。使用一种机制来生成依赖图,例如在IDE IntelliJ Idea中。
http://blog.jetbrains.com/idea/2010/05/maven-dependencies-diagram/
您需要了解哪些依赖项包含所需的库版本并将其排除:
例如:
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>version</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>