du-*_*-it 48 eclipse spring spring-mvc maven
我有一个基于代码的mavenized配置Spring 3.2.4 Web应用程序.当我使用Maven/pom.xml构建应用程序时,我得到一个错误,即web.xml丢失.首先,我尝试创建一个空的web.xml.这是项目方面发生变化的时刻(我不知道为什么).它从动态Web模块3.0切换到3.1,这是不可逆转的.如何将其再次更改为Dynamic Web Modules 3.0 ???

另外我无法删除JAX-RS.尝试这样做会导致:
Failed while uninstalling JAX-RS (REST Web Services) 1.0.
org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp
Run Code Online (Sandbox Code Playgroud)
后来我发现我可以通过在pom.xml中插入相应的插件来避免Maven编译错误:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
dim*_*niy 70
我在日食中遇到了类似的麻烦,唯一可以解决这个问题的方法就是
只需确保在应用之前配置Web模块,因为默认情况下它会在/ WebContent /中查找您的Web文件,而这不是Maven项目结构应该是什么.
编辑:
如果没有别的帮助,这是第二种方式
org.eclipse.wst.common.project.facet.core.xml,进行备份,然后删除Web模块条目. Ale*_*rev 61
如果要使用3.1版,则需要使用以下模式:
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd请注意,3.0和3.1是不同的:在3.1中没有提到Sun,因此只需更改3_0.xsd为3_1.xsd不起作用.
它应该是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
</web-app>
Run Code Online (Sandbox Code Playgroud)
此外,请确保您依赖于您的最新版本pom.xml.那是,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
...
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
和
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
最后,您应该使用Java 7或8进行编译:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
小智 9
我遇到了同样的问题,并通过编辑org.eclipse.wst.common.project.facet.core.xml来解决这个问题.
在这个文件中,我能够更改以下行
<installed facet="jst.web" version="3.1"/>
Run Code Online (Sandbox Code Playgroud)
回到
<installed facet="jst.web" version="3.0"/>
Run Code Online (Sandbox Code Playgroud)
这似乎解决了我的问题.
| 归档时间: |
|
| 查看次数: |
121265 次 |
| 最近记录: |