我试图与科伯拉1.9.4.1进行仪器战争。为此,我使用以下蚂蚁任务,该任务使用Maven-Antrun-Plugin进行调用:
<target name="instrumentEar">
<cobertura-instrument todir="${module}/target/${ear.dir}">
<includeclasses regex="nl.*" />
<fileset dir="${module}/target/${ear.dir}">
<include name="**/*.war"/>
</fileset>
</cobertura-instrument>
</target>
执行后,输出为:
[INFO] --- maven-antrun-plugin:1.3:run (instrument) @ my-ear ---
[INFO] Executing tasks
instrumentEar:
[cobertura-instrument] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] Instrumenting 2 files to D:workspacemy-eartargetmy-ear-1.0.0-SNAPSHOT
[cobertura-instrument] Cobertura: Error closing output stream.
[cobertura-instrument] java.util.zip.ZipException: ZIP file must have at least one entry
[cobertura-instrument] at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
[cobertura-instrument] at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
[cobertura-instrument] at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
[cobertura-instrument] at net.sourceforge.cobertura.util.IOUtil.closeOutputStream(IOUtil.java:165)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.addInstrumentationToArchive(Main.java:319)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:488)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.main(Main.java:514)
[cobertura-instrument] Cobertura: Error closing output stream.
[cobertura-instrument] java.util.zip.ZipException: ZIP file must have at least one entry
[cobertura-instrument] at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
[cobertura-instrument] at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
[cobertura-instrument] at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
[cobertura-instrument] at net.sourceforge.cobertura.util.IOUtil.closeOutputStream(IOUtil.java:165)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.addInstrumentationToArchive(Main.java:319)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.parseArguments(Main.java:488)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.Main.main(Main.java:514)
[cobertura-instrument] Cobertura: Saved information on 0 classes.
[cobertura-instrument] Instrument time: 67ms
似乎蚂蚁无法阅读Maven造成的战争。我记得很久以前,我在Java Zip实现方面遇到了问题,并使用了ANT的ZIP。难道这里发生了类似的事情,但是反转了吗?
这个线程建议这应该起作用,但是有些人建议在仪器之前先提取战争。
任何人在蚂蚁任务(Cobertura-instrument)中是否有任何成功?
我已经通过分别从战争中包含的不同项目来启动类文件,然后将它们合并到启动应用程序服务器的目录中。
我已经为每个项目提供了各个项目的覆盖范围,因此合并动作实际上需要添加。
因此无需进行战争。