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

前端 未结 23 2189
小蘑菇
小蘑菇 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:49

    We tried everything listed so far and it still failed. The error also mentioned

    (default-war) on project utilsJava: Error assembling WAR: webxml attribute is required

    The solution that finally fixed it was adding this to POM:

    <failOnMissingWebXml>false</failOnMissingWebXml>
    

    As mentioned here Error assembling WAR - webxml attribute is required

    Our POM now contains this:

    <plugin>
    <inherited>true</inherited>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>${maven-war-plugin.version}</version>
    <configuration>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <warName>${project.artifactId}</warName>
    <attachClasses>true</attachClasses>
    </configuration>
    </plugin>  
    
    0 讨论(0)
  • 2020-11-29 16:50

    Maybe you can add this dependency to your pom.xml. I use this method and solve the problem!

    <dependency> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-resources-plugin</artifactId> 
        <version>2.3.2</version> 
    </dependency>
    
    0 讨论(0)
  • 2020-11-29 16:51

    for the new users on Mac os , find out .m2 folder and delete it, its on your /Users/.m2 directory.

    you wont get to see .m2 folder in finder(File Explorer), for this user this command to Show Mac hidden files

    $ defaults write com.apple.finder AppleShowAllFiles TRUE

    after this press alt and click on finder-> relaunch, you can see /Users/.m2

    to hide files again, simply use this $ defaults write com.apple.finder AppleShowAllFiles false

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

    It is because your Maven not able to find settings file. If deleting .m2 not work, try below solution

    Go to your JOB configuration

    than to the Build section

    Add build step :- Invoke top level maven target and fill Maven version and Goal

    than click on Advance button and mention settings file path as mention in image

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

    Usually, define maven-compiler-plugin is sufficient enough. add the following to your compiler plugin definition.

    <plugin>
        <inherited>true</inherited>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>              
    </plugin>
    
    0 讨论(0)
提交回复
热议问题