当前位置:首页 » 网页前端 » maven的webxml配置
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

maven的webxml配置

发布时间: 2022-07-27 19:57:11

㈠ maven 怎么配置webapp

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>
${basedir}/webapp
</warSourceDirectory>
<!-- <packagingExcludes>**/*.svn</packagingExcludes>
<warSourceExcludes>**/*.svn</warSourceExcludes>
<warSourceIncludes>**/*.js,**/*.jsp,**/*.jpg,**/*.css,**/*.tld,**/*.xml</warSourceIncludes>
-->
<webXml>${basedir}/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>

㈡ 新建的maven为什么没有web.xml

第一步,新建maven项目

第二步,选择web模板

㈢ maven web怎么修改pom.xml

新建的maven项目,项目内代码及pom.xml没有任何问题,但项目上就是有红叉,这时点开Markers(Window-->show veiw-->Markers),查看错误的详细信息,信息上:Project configuration is not up-to-date with pom.xml. Run project configuration update
按照提示做即可:项目右击-->Maven-->Update Project Configuration,红叉即消失。
实际应用中出现红叉的原因有很多,这时都可以查看Markers里的详细信息,有的放矢。

㈣ JAVA maven创建web项目,把Spring框架配置文件放在src/main/resources中读取不到配置文件

classpath:是从类路径里查找配置文件,也就是/WEB-INF/classes目录下找SpringMVC-servlet.xml。

你写了classpath了,不会从web-info下找,而是去web-inf/classes下面找,所以找不到。

㈤ maven开发怎么配置web.xml

load-on-startup配置在中,见本工程配置。 load-on-startup元素在web应用启动的时候指定了servlet被加载的顺序,它的值必须是一个整数。 在servlet的配置中,1 的含义是:容器在启动的时候就加载这个servlet。

㈥ maven整合springmvc需要配置web.xml吗

需要啊,maven起到的作用是不用自己导入相关的jar包和依赖的jar包

㈦ maven总是配置不成功,是什么原因

遇到的问题和解决

错误1 :
[ERROR] Failed to execute goal on project biz_zhuhai: Could not resolve
dependencies for project biz_zhuhai:biz_zhuhai:jar:0.0.1-SNAPSHOT:
Failed to collect dependencies for [com.maywide.ibh:lib345:pom:1.0
(compile)]: Failed to read artifact descriptor for
com.maywide.ibh:lib345:pom:1.0: Could not transfer artifact
com.maywide.ibh:lib345:pom:1.0 from/to releases
(http://localhost:9888/nexus-2.0.3/content/repositories/releases):
Connection to http://localhost:9888 refused: Connection refused: connect
-> [Help 1]

解决:这是配置的url有错误或者是私服没有配好,导致构件下载时出错。如果没有jar包需要在私服里下载,可以不配置私服的,可以把setting.xml的profiles里的东西全部删除的。

错误2:[ERROR]
Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test)
on project web_nanchang: There are test failures.

[ERROR]

[ERROR] Please refer to E:\maven\web_nanchang\target\surefire-reports for the indivial test results.

解决:这是因为测试代码时遇到错误,会停止编译。只需要在pom.xml的<project>里添加以下配置,使得测试出错不影响项目的编译。

<build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<configuration>

<testFailureIgnore>true</testFailureIgnore>

</configuration>

</plugin>

</plugins>

</build>

错误3:

[ERROR]
Failed to execute goal
org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on
project web_nanchang: 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:

解决:maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。解决方法在pom.xml加入以下的配置。红色背景字体改成你网站的根目录。

<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>WebContent</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>

错误4:
严重: The web application [/web_nanchang] registered the JBDC driver
[org.hsqldb.jdbc.JDBCDriver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has
been forcibly unregistered.

2012-4-27 10:36:49 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc

严重: The web
application [/web_nanchang] registered the JBDC driver
[com.mysql.jdbc.Driver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has
been forcibly unregistered.

不知道怎样解决,导致运行不了。

错误5:

把java complier改成1.6或者disabled dependency manangent后在enable消失了。

㈧ maven怎么生成web.xml

项目右键-properties-project facets-勾选dynamic web moudle