maven項目打包時報錯:Error injecting constructor, java.lang.ExceptionInInitializerError: Cannot access defaults field of Properties at org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source) while locating org.apache.maven.plugin.war.WarMojo
在定位 org.apache.maven.plugin.war.WarMojo 時無法訪問 org.apache.maven.plugin.war.WarMojo.<init>(Unknown Source) 處的屬性的默認字段
在網上找了很多方法,最后得出結論:與代碼無關,在pom.xml中指定package插件的版本即可:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.2.2</version> </plugin> </plugins> </build>
我的jdk版本為16,改為目前最新的package插件版本3.2.2即可成功打包