Introduction
This article is a specific article for solving an error message appear. The error appear at the time of the execution of a Java application or program. The execution occur in NetBeans IDE. By selecting the Java Project in the NetBeans IDE and the right click at it, select the Run menu to start the execution. It suddenly will run maven for building, compiling and deploying it to Wildfly Application Server in this context. All of those processes exist in a PC or laptop using Microsoft Windows operating system. The following is the output which exist in the output Tab as part of the NetBeans. It exist as follows :
------------------------------------------------------- T E S T S ------------------------------------------------------- Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 ------------------------------------------------------------------------ BUILD FAILURE ------------------------------------------------------------------------ Total time: 20.065s Finished at: Thu Feb 17 20:34:27 ICT 2022 Final Memory: 8M/126M ------------------------------------------------------------------------ Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.3.2:war (default-war) on project apps: The plugin org.apache.maven.plugins:maven-war-plugin:3.3.2 requires Maven version 3.1.0 -> [Help 1] To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginIncompatibleException
Before getting on to the solution for solving the above problem, the following is part of the pom.xml file which is describing the definition of the maven-war-plugin :
<plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.3.2</version> </plugin> </plugins>
Solution
Actually, after searching through google using the error message as part of the keyword, there is an alternative solution to solve it. It exist in one of the stackoverflow page in this link. There is part of the content in that page informing several alternative solution. One of the attempt as a solution is by changing the version of the plugin ‘maven-war-plugin’. By changing it from ‘maven-war-plugin’ 3.3.2 to ‘maven-war-plugin’ 3.0. The modification exist of follows :
<plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.3.2</version> </plugin> </plugins>
But the modification just create another error. The error exist in this link. Actually, just modifying the version of the ‘maven-war-plugin’ is not the answer to it. But it need to be a specific version. The reason exist in the error message. That exist as part of the following part of the output message as follows :
The plugin org.apache.maven.plugins:maven-war-plugin:3.3.2 requires Maven version 3.1.0
In this context, the PC or laptop for running the Java Application is using a specific version of the maven tool. But the maven version is not ‘3.1.0’. So, what is the version exist and currently running. The following is one of the way for checking it. Just execute the Command Prompt and then type ‘mvn -version’ command to be able to see the version as follows :
C:\Users\Personal>mvn -version Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 20:51:28+0700) Maven home: C:\netbeans-8.2\java\maven\bin\.. Java version: 1.8.0_181, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_181\jre Default locale: en_ID, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos" C:\Users\Personal>
So, it need the suitable version of maven-war-plugin with the maven tool. Try by changing the version in order to upgrade or to downgrade it. The first attempt is by changing the ‘maven-war-plugin’ into 3.3.1 as follows :
<plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.3.1</version> </plugin> </plugins>
After changing the version of the maven-war-plugin downgrading it from ‘3.3.2’ to ‘3.3.1’, it is actually working. The following one is the output where the building and deploying it with the revision of the version of ‘maven-war-plugin’ :
------------------------------------------------------- T E S T S ------------------------------------------------------- Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 --- maven-war-plugin:3.3.1:war (default-war) @ apps --- Packaging webapp Assembling webapp [apps] in [C:\training\java\apps\target\apps] Processing war project Copying webapp resources [C:\training\java\apps\target\apps\src\main\webapp] Building war: C:\training\java\apps\target\apps\target\apps.war ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 51.154s Finished at: Thu Feb 17 23:00:24 ICT 2022 Final Memory: 11M/130M ------------------------------------------------------------------------ Deploying on WildFly Application Server profile mode: false debug mode: false force redeploy: true Undeploying ... Initial deploying demo_java to C:\wildfly-21.0.2.Final\standalone\deployments\apps.war Completed initial distribution of apps Deploying C:\wildfly-21.0.2.Final\standalone\deployments\apps.war Application Deployed
One thought on “How to Solve Error Message The plugin org.apache.maven.plugins:maven-war-plugin:3.3.2 requires Maven version 3.1.0 when build and deploy Java Application to Wildfly using maven in NetBeans”