【发布时间】:2018-02-06 20:45:06
【问题描述】:
问题:
我正在尝试来自 git hub 位置 https://github.com/javaee-samples/javaee7-samples/tree/master/jsf/bean-validation 的示例 JSF bean 验证应用程序。
我对pom.xml 文件和settings.xml 进行了必要的自定义更改,以指向我自己的本地.m2/repository。在 Wildfly 10 上部署应用程序并通过 url 作为 http://localhost:8180/bean-validation/faces 访问它后,我无法访问欢迎页面。
但是当我将 url 重写为 http://localhost:8180/bean-validation-1.0-SNAPSHOT/faces 时,我可以访问欢迎页面。
我看到在 Server--->Deployment 文件夹中,bean-validation .war 已由 maven(通过命令行中的 mvn install 命令)部署为 bean-validation-1.0-SNAPSHOT.war
我需要在我的 pom.xml 文件中进行哪些更改才能访问 URL 中仅包含 Web 应用程序名称的页面?
我自定义的pom.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- <parent>
<groupId>org.javaee7.jsf</groupId>
<artifactId>jsf-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent> -->
<groupId>org.javaee7.jsf</groupId>
<artifactId>bean-validation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
</dependency>
<!-- <dependency>
<groupId>javax.enterprise</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
</dependency> -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<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>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
【问题讨论】:
标签: maven jakarta-ee pom.xml contextpath