Solve the error in Maven project packaging: error injecting constructor

Error in Maven project packaging: 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

When locating org.apache.maven.plugin.war.warmojo, you cannot access org.apache.maven.plugin.war.warmojo. & lt; init>( Default field for the property at unknown source)

 

I found many methods on the Internet and finally came to the conclusion that it has nothing to do with the code. Just specify the package plug-in version in pom.xml:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.2</version>
            </plugin>

        </plugins>
    </build>

My JDK version is 16. Change to the latest package plug-in version 3.2.2 to package successfully

 

Similar Posts: