我正在尝试运行build-sql
蚂蚁任务,它给了我以下[hibernatetool] java.util.zip.ZipException: error in opening zip file
。因为它表明此任务实际上做了很多事情,但它没有填充它应该填充的数据库表。我认为这是因为我得到的这个错误。当我在某处读到它时,可能是因为 WEB-INF
内部有一个.properties
文件,我在项目的WEB-INF
中没有任何.properties
文件。
<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)
我只是无法理解这背后的原因。
此外,有时当我尝试在我的项目pom.xml
上调整mvn install
时,我也会遇到以下情况。我正在使用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:Userslawson.m2repositoryorgapachexmlgraphicsbatik-util1.7batik-util-1.7.jar; cannot read zip file entry
我不确定它们是否相关,但它们似乎已经让我发疯了,因为我只是不知道为什么我会收到这些错误。
有人可以帮助了解我在这里缺少什么来解决这些问题。
谢谢。
删除存储库中的文件夹,maven 将再次下载它。
C:Userslawson.m2repositoryorgapachexmlgraphicsbatik-util