概述
一直在用maven来管理项目,感觉到maven的强大,但是使用maven来生成web项目的时候,老实没办法生成web 项目,每次总是要改一下facets, 今天终于弄清楚了。
1,在pom中需要添加 maven-war-plugin 比如:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>这里添加version的话对应与faces 中web的version
<configuration>
<attachClasses>true</attachClasses>
<webResources>
<resource>
<directory>target/main/webapp</directory>
</resource>
</webResources>
</configuration>
</plugin>
2, 在pom中需要添加maven-eclipse-plugin 并在其中指定wtp(web tool project的配置)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<projectNameTemplate>pinpoint-web</projectNameTemplate>
<wtpContextName>pinpoint-web</wtpContextName>
<additionalProjectFacets>
<wst.jsdt.web>1.0</wst.jsdt.web><!--对应与faces js的选项-->
</additionalProjectFacets>
<additionalProjectnatures>
<projectnature>org.eclipse.wst.jsdt.core.jsNature</projectnature>
</additionalProjectnatures>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
下面的这个pom的配置是可以正确生成web project 的
<
project
>
<
packaging
>war</
packaging
>
<
dependencies
>
[...]
</
dependencies
>
<
build
>
<
resources
>
<
resource
>
<
directory
>src/main/java</
directory
>
<
includes
>
<
include
>**/*.xml</
include
>
<
include
>**/*.xsd</
include
>
<
include
>**/*.wsdl</
include
>
</
includes
>
</
resource
>
</
resources
>
<
testResources
>
<
testResource
>
<
directory
>src/test/java</
directory
>
<
includes
>
<
include
>**/*.xml</
include
>
</
includes
>
</
testResource
>
</
testResources
>
<
plugins
>
<
plugin
>
<
groupId
>org.apache.maven.plugins</
groupId
>
<
artifactId
>maven-compiler-plugin</
artifactId
>
<
configuration
>
<
source
>1.6</
source
>
<
target
>1.6</
target
>
</
configuration
>
</
plugin
>
<
plugin
>
<
artifactId
>maven-war-plugin</
artifactId
>
<
version
>2.1.1</
version
>
</
plugin
>
<
plugin
>
<
groupId
>org.apache.maven.plugins</
groupId
>
<
artifactId
>maven-eclipse-plugin</
artifactId
>
<
configuration
>
<
wtpapplicationxml
>true</
wtpapplicationxml
>
<
wtpversion
>2.0</
wtpversion
>
</
configuration
>
</
plugin
>
</
plugins
>
</
build
>
</
project
>
最后
以上就是外向小土豆为你收集整理的maven eclipse:clean eclipse:eclipse web project的全部内容,希望文章能够帮你解决maven eclipse:clean eclipse:eclipse web project所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复