Error generating jar project

Asked

Viewed 124 times

0

I wanted to generate a JAR of the project I made in Maven(simple). But it generates this error. Why generated this error?

[INFO] --- maven-war-plugin:2.2:war (default-war) @ teste-MODEL ---
[INFO] Packaging webapp
[INFO] Assembling webapp [teste-MODEL] in [C:\Users\ooo\Documents\workspace-ggts-3.6.4.RELEASE\teste-   MODEL\target\teste-MODEL-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\ooo\Documents\workspace-ggts-  3.6.4.RELEASE\teste-MODEL\src\main\webapp]
[INFO] Webapp assembled in [50 msecs]
[INFO] Building war: C:\Users\ooo\Documents\workspace-ggts-3.6.4.RELEASE\teste-MODEL\target\teste-MODEL-0.0.1-SNAPSHOT.war

[INFO] BUILD FAILURE

[INFO] Total time: 3.480 s
[INFO] Finished at: 2016-02-10T01:06:15-03:00
[INFO] Final Memory: 8M/21M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project teste-MODEL: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]   http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  • jar. D I go to sleep, detail later.

  • 1

    Include your pom.xml. By the log, the Packaging of your project is war, can only try removing the element <packaging />

  • Along with the pom.xml, also include the web.xml of the project.

1 answer

0

If your application does not use web.xml for some reason (Servlet 3.0 for example), you can skip validating that file.

Add the code below in the section plugins of your pom.xml

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>

Withdrawn of that stackoverflow link

Browser other questions tagged

You are not signed in. Login or sign up in order to post.