Intellij,web faces 到底是做什么的,为什么它一直坚持 /web 目录

Intellij, what are web faces really do, and why does it keep insisting on /web directory

即使在 tomcat 重启后 web.xml 更新也没有重新加载存在问题

花了一整天的时间来修复它,以便它可以正常工作。

我通常会自动配置 web 面孔,无论我是否想要它们,但 Intellij 坚持使用目录 /web ,尽管我根本没有使用它,有时甚至会为我创建它。

网络面孔有什么用?也许这会解决我的问题?但是intellij怎么能停止坚持web目录呢?

我什至配置了:

<webResources>
    <resource>
        <directory>assets</directory>
    </resource>
</webResources>

但它仍然坚持网页目录。问题是我有几个模块,我发现以后重新配置项目会使体力劳动难以为继。

IDE 遵循 Maven 规则。如果您尝试执行 Maven 的 war:war 目标,您应该会得到相同的结果。配置如

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.2.0</version>
    <configuration>
        <webResources>
            <resource>
                <!-- this is relative to the pom.xml directory -->
                <directory>assets/</directory>
            </resource>
        </webResources>
    </configuration>
</plugin>

Maven 将 assets(相对于 pom.xml 文件)添加为 Web 资源目录,并 IDE 在 Web 方面设置中添加它。 如果要排除默认 webapp 目录,请选中 this thread

例如:

<warSourceDirectory>resources</warSourceDirectory>