Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)

前端 未结 23 2190
小蘑菇
小蘑菇 2020-11-29 15:55

I am using Maven 3.0.5 and Spring Tool Source 3.2 with Maven plugin installed. When I try to do \'Run As---> Maven install\', I am getting

相关标签:
23条回答
  • 2020-11-29 16:34

    Deleting full .m2/repository local repository solved my problem.

    Or else you need to know what plugins are you using exactly with their dependencies as one of the plugin suffered a problem while downloading.

    0 讨论(0)
  • 2020-11-29 16:34

    I had the same problem, check the installed jre used by Maven in your Run Configuration...

    In your case, I think that the maven-compiler-plugin:jar:2.3.2 needs a jdk1.6

    To do this : Run Configuration > YOUR_MAVEN_BUILD > JRE > Alternate JRE

    Hope this helps.

    0 讨论(0)
  • 2020-11-29 16:36

    Sometimes this issue comes because the java.version which you have mentioned in POM.xml is not the one installed in your machine.

    <properties>
        <java.version>1.7</java.version>
    </properties>
    

    Ensure you exactly mention the same version in your pom.xml as the jdk and jre version present in your machine.

    0 讨论(0)
  • 2020-11-29 16:38

    It's really incredible to be oblige to erase whole .m2/repository content. I suggest to type this command (On Windows) :

    mvn clean

    mvn -X package > my_log_file.log

    The last command enable Debug option et redirect output to a file. Open the file and search ERROR or WARNING key words. You can find this kind of expression :

    DEBUG] =======================================================================
    [WARNING] The POM for javax.servlet:javax.servlet-api:jar:4.0.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for javax.servlet:javax.servlet-api:4.0.0
    [FATAL] Non-parseable POM C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</profiles>\n\n</project>\n\n<?xml ... @160:7)  @ C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom, line 160, column 7
    
    [WARNING] The POM for org.glassfish:javax.json:jar:1.0.4 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for org.glassfish:javax.json:[unknown-version]
    [FATAL] Non-parseable POM C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</profiles>\n\n</project>\n\n<?xml ... @160:7)  @ C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom, line 160, column 7
    

    It's esay in this case to understand you have just to delete directory C:\Users\vifie.m2\repository\net\java\jvnet-parent\3

    Relaunch compilation, packaging and so on :

    mvn package

    WARNING disappear just because you delete POM file corrupted at the good location and maven re download it. Normally the new POM file is better.

    Often debug mode give you messages with more comprehensive details.

    Why I redirect log to a file : Simply because on Windows console don't have enough buffer to store all lines and often you cannot see all lines.

    0 讨论(0)
  • 2020-11-29 16:43

    Either remove the below code from the pom.xml or correct your java version to make it work.

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.0</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
    
    0 讨论(0)
  • 2020-11-29 16:44

    For me, restarting Eclipse got rid of this error!

    0 讨论(0)
提交回复
热议问题