0

Eu queria gerar um JAR do projeto que fiz no maven(simples). Mas gera esse erro. Por que gerou esse erro?

[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
3
  • jar. :D Vou dormir, detalho mais tarde.
    – Aline
    10/02/2016 às 4:53
  • 1
    Inclua seu pom.xml. Pelo log, o packaging do seu projeto é war, pode tentar apenas removendo o elemento <packaging /> 10/02/2016 às 13:06
  • Juntamente com o pom.xml, inclua também o web.xml do projeto. 11/02/2016 às 2:32

1 Resposta 1

0

Se a sua aplicação não usa web.xml por algum motivo (servlet 3.0 por exemplo), você pode ignorar a validação desse arquivo.

Adicione o código abaixo na seção plugins do seu pom.xml

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

Retirado desse link do stackoverflow

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .