我正在尝试运行build-sql
ant 任务,它给了我以下内容[hibernatetool] java.util.zip.ZipException: error in opening zip file
。正如它显示的那样,这个任务做了很多它实际上做的事情,但它没有填充它应该填充的数据库表。我认为这是因为我得到了这个错误。当我在某处读到它可能是因为.properties
里面有一个文件WEB-INF
时,我在项目中没有任何.properties
文件WEB-INF
。
<target name="build-sql">
<mkdir dir="target/sql"/>
<artifact:pom id="myPom" file="pom.xml" />
<artifact:dependencies filesetId="pomDeps" pomRefId="myPom" useScope="compile" />
<property name="baseTarget" location="target/${myPom.build.finalName}/WEB-INF"/>
<fileset id="libDir" dir="${baseTarget}/lib"/>
<path id="build.runtime.classpath">
<restrict>
<difference>
<fileset refid="pomDeps" />
<intersect>
<fileset refid="pomDeps" />
<fileset refid="libDir" />
</intersect>
</difference>
<rsel:not>
<rsel:name name="**/*.pom" />
</rsel:not>
</restrict>
<fileset refid="libDir"/>
</path>
<taskdef name="hibernatetool" classname="org.tbs.common.util.sql.HibernateToolTask" classpathref="build.runtime.classpath" />
<hibernatetool destDir="target/sql" combinePersistenceUnits="false" refineFileNames="true">
<classPathApplicationContext path="tbs-open-admin-contentClient-applicationContext.xml"/>
<classPathApplicationContext path="tbs-cms-contentClient-applicationContext.xml"/>
<classPathApplicationContext path="headmaster-applicationContext.xml"/>
<jpaconfiguration persistenceUnit="tbsPU" dialect="org.hibernate.dialect.MySQLDialect" />
<jpaconfiguration persistenceUnit="tbsSecurePU" dialect="org.hibernate.dialect.MySQLDialect" />
<jpaconfiguration persistenceUnit="tbsCMSStorage" dialect="org.hibernate.dialect.MySQLDialect" />
<classpath refid="build.runtime.classpath" />
<hbm2ddl export="false"/>
</hibernatetool>
</target>
以下是日志记录的错误部分:
[hibernatetool] java.util.zip.ZipException: error in opening zip file
[hibernatetool] at java.util.zip.ZipFile.open(Native Method)
[hibernatetool] at java.util.zip.ZipFile.<init>(ZipFile.java:114)
[hibernatetool] at java.util.zip.ZipFile.<init>(ZipFile.java:131)
[hibernatetool] at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1028)
[hibernatetool] at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:147)
[hibernatetool] at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.<init>(AntClassLoader.java:109)
[hibernatetool] at org.apache.tools.ant.AntClassLoader.findResources(AntClassLoader.java:975)
[hibernatetool] at java.lang.ClassLoader.getResources(ClassLoader.java:996)
[hibernatetool] at org.slf4j.LoggerFactory.singleImplementationSanityCheck(LoggerFactory.java:212)
[hibernatetool] at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:110)
[hibernatetool] at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
[hibernatetool] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
[hibernatetool] at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
[hibernatetool] at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
[hibernatetool] at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
[hibernatetool] at org.tbs.common.extensibility.context.StandardConfigLocations.<clinit>(StandardConfigLocations.java:29)
[hibernatetool] at org.tbs.common.util.sql.HibernateToolTask.execute(HibernateToolTask.java:131)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[hibernatetool] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatetool] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[hibernatetool] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatetool] at java.lang.reflect.Method.invoke(Method.java:597)
[hibernatetool] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:348)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:357)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[hibernatetool] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[hibernatetool] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[hibernatetool] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[hibernatetool] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
[hibernatetool] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)
我只是无法理解这背后的原因。
此外,有时当我尝试调整mvn install
我的项目时,我也会得到以下信息pom.xml
。我正在使用 Eclipse Java EE IDE Helios。
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project natura: Compilation failure
[ERROR] error: error reading C:\Users\lawson\.m2\repository\org\apache\xmlgraphics\batik-util\1.7\batik-util-1.7.jar; cannot read zip file entry
我不确定它们是否相关,但它们似乎已经让我发疯了,因为我无法弄清楚为什么会出现这些错误。
有人可以帮助了解我在这里缺少什么来解决这些问题。
谢谢。