Error assembling WAR: webxml attribute is required

发布时间 2023-11-23 16:20:43作者: 金天黑日

转:https://blog.csdn.net/wang124454731/article/details/69569165

1 maven打包的过程中的两个问题

1.1 The repository system is offline but the artifact com.zrw:zrw-parent:pom:1.0 is not available in the local repository

  如果有依赖其他项目,先将其他项目执行maven的install,执行install会在本地repository生成对应jar包,不然其他项目直接依赖此项目会报找不到jar包

 

1.2 Error assembling WAR: webxml attribute is required

  打包war项目,必须指向一个web.xml文件,没有就会报错,web.xml文件的路径可配置,如下

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <configuration>
      <webXml>webapps\WEB-INF\web.xml</webXml>
   </configuration>
</plugin>

  由于spring-boot不需要web.xml文件,可以加入以下配置

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