Thursday, February 22, 2024

Maven Build compilation Error | Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war

When you are using Java 17 and trying to compile your Java project using Maven, you may experience this error. this is due to version incompatible issue of maven war plug-in.



you can upgrade your Java version in Jenkins by executing below command:
sudo apt install openjdk-17-jdk -y

or you can follow steps to setup Jenkins with Java 17.

Fix in your Java Web App:

Add following plug-in to pom.xml of your Java Project to fix the build issue:

  <build>
    <finalName>MyWebApp</finalName>
     <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
      </plugins>

  </build>
</project>

Save the pom.xml and re-run the build.


No comments:

Post a Comment

DevSecOps Bootcamp Feb 2025 Schedule | DevOps & AWS Azure Cloud Coaching by Coach AK | DevSecOps and Cloud Computing Online Classes

🚀 Join the Ultimate DevSecOps Bootcamp – February 2025! 🔥 Are you ready to supercharge your career in DevSecOps ? Whether you're a be...