0
在我們公司,我們將Maven添加到項目比從未有過,但我們需要我們的項目使用動態Web模塊2.5方面,因爲我們將部署它一個Tomcat 6服務器,我們不允許用Tomcat 7服務器替換它。無法將動態Web模塊方面從3.0更改爲2.5
我可以手動將Facet設置爲2.5,但事情是,當我使用Maven工具更新Eclipse上的項目時,它會自動將其更改爲3.0。
我已經嘗試了幾十個解決方案,例如更改web.xml頭文件,更改Facets和按照特定順序更新項目,向pom.xml文件添加了一些內容,但沒有一個能夠工作,大多數我一直在尋找的地方,人們以另一種方式遇到了問題。
這裏是pom.xml中
<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>
<groupId>Stofi</groupId>
<artifactId>Stofi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<src.dir>src</src.dir>
<basedir></basedir>
</properties>
<build>
<directory>${project.basedir}/target</directory>
<outputDirectory>target/classes</outputDirectory>
<finalName>${project.artifactId}</finalName>
<testOutputDirectory>target/test-classes</testOutputDirectory>
<sourceDirectory>${src.dir}</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>src/Idiomas</directory>
<!-- <excludes> -->
<!-- <exclude>**/*.properties</exclude> -->
<!-- </excludes> -->
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<version>3.1</version>
<excludes>
<exclude>src/Idiomas</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>WebContent</webappDirectory>
<packagingExcludes>src\Idiomas</packagingExcludes>
<packagingExcludes>WEB-INF\classes\*.properties</packagingExcludes>
<packagingExcludes>WEB-INF\classes\**\*.java</packagingExcludes>
<!-- <outputDirectory>C:\Desarrollo\ServersPruebas\tomcat_stofi\webapps</outputDirectory> -->
<webResources>
<resource>
<targetPath>WEB-INF\classes\Idiomas\</targetPath>
<filtering>false</filtering>
<directory>src\Idiomas</directory>
<includes>
<include>**\*.*</include>
</includes>
<excludes>
<exclude>**\*.git</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.1.6.RELEASE</version>
<scope>test</scope>
</dependency> -->
<!-- LOCAL LIBRARIES -->
</dependencies>
<packaging>war</packaging>
</project>
這裏是WEB.XML頭
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
這裏是org.eclipse.wst.common.project.facet.core.xml的
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.java"/>
<installed facet="jst.java" version="1.6"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="2.5"/>
</faceted-project>
謝謝大家的回覆。
下面是pom.xml中 –
[編輯] pom.yml文件到的主要問題,那麼我們就可以爲什麼,爲什麼,你使用'Maven的Eclipse的plugin'幫助你 – Ferrybig
?刪除它並安裝M2Eclipse。 – Tunaki