Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor

后端 未结 14 846
执念已碎
执念已碎 2021-01-30 12:27
[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[IN         


        
相关标签:
14条回答
  • 2021-01-30 13:03

    This definitely seems to be related to incompatible plugin, library and language versions.

    Two years, and two Java versions later, I had this same error while doing a sample project from an older book on Spring and Hibernate.

    I was able to resolve the error by commenting out all of the version tags for the apache.maven.plugins and setting the Java version to 1.8. This let me know what was the latest and greatest version of the libraries, with the cost of some warnings from Maven about missing the version tags. If you care about the warnings, you can set the version tags to be latest version and the warnings from Maven should go away.

    I executed mvn clean package and then just mvn package.

    <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
    <!-- <version>2.1-beta-1</version> -->
    </plugin>
    <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
    <!-- <version>2.1</version> -->
         <configuration>
              <source>1.8</source>
              <target>1.8</target>
         </configuration>
    </plugin>
    
    0 讨论(0)
  • 2021-01-30 13:07

    Apache Maven WAR Plugin 3.0.0 resolved all issues:

    <artifactId>maven-war-plugin</artifactId>
    <version>3.0.0</version>
    

    It doesn't matter if you use jdk 1.6, 1.7 or 1.8

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