Maven Ant Task tries to open pom as zip and fails

236 views Asked by At

I am trying to run an Maven Ant Task with plugin version 2.1.3 and for some reason running into this error:

[javac] Compiling 101 source files to /home/raido/Workspace2/foobar/classes
[javac] error: error reading /home/raido/.m2/repository/foobar/1.0/foobar-1.0.pom; error in opening zip file
[javac] 1 error

Why is it trying to read a xml file as an zip file and how can I avoid this? The file itself is perfectly fine and readable.

That part from the build.xml file:

<target name="compile" depends="init">
    <mkdir dir="${build.dir}" />
    <mkdir dir="${classes.dir}" />
    <javac classpathref="compile.dependency.path" debug="on"
        encoding="UTF-8" 
        deprecation="on" destdir="${classes.dir}"
        includes="bar/**/*.java" optimize="off"
        srcdir="${src.dir}" />
</target>

The error is targeted to the closing sign > on the srcdir row i.e. the whole tag.

3

There are 3 answers

0
Raidok On BEST ANSWER

I finally figured it out. The problem was that the main ant file had a specific task that produced JAR-s of the modules but I hadn't done it. This shows how important documentation sometimes is which this project doesn't have at all!

2
Jigar Joshi On

It might be corrupt zip. you can remove the foobar/1.0/ dir from your maven repos and let maven download new fresh version

0
carlspring On

Show us your definition of compile.dependency.path. Seems like the pattern there is not quite correct and allows .pom files (if it's **/**, for example), which will clearly not work.