• Maven’s common problems and solutions

    1. No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    As the error message display,perhaps you used JRE for maven, but it needs JDK(in fact, javac) as compiler. JRE is just the Java runtime environment, while JDK is the Java development kit containing the the compiler javac for java code. In fact, Eclipse uses JRE as its default environment, and used its own compiler JDT. So when using maven to compile, the operation fails.

    Solution: go into  Windows -> Perferences -> Java -> Installed JREs. Note the underlined part is jdk not jre.

    .jres

     

    2. Could not resolve dependencies for project XXX:jar:0.1: Failure to find XXX:jar:0.0.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.

    There are some files with the names ending in the .lastUplated suffix in your local repository, so maven will not compile again.

    Solution:

    1) for maven command: mvn clean install -U

    2) for Eclipse:

    mvn

     

    3. error reading C:\Users\Administrator\.m2\repository\XXX.jar; invalid LOC header (bad signature)

    That is because there are some incomplete in maven local repository. May be you can see some files with names ending in -in-progress suffix.

    123
    Solution: delete the whole folder which contains the incomplete jar file, and compile again.