我不熟悉Maven项目的东西,所以我想将它转换为Eclipse中的动态Web项目。该Maven项目包括一个Web项目和其中的其他子项目。真的不知道如何将所有这些受支持的项目与maven web项目一起转换为基于Eclipse的动态Web项目。请帮忙。
答案 0 :(得分:1)
在你的pom上添加这个插件
<!-- Maven Eclipse Plugin -->
<!-- version 2.9 has testSourcesLast flag but does not delete .settings -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<useProjectReferences>false</useProjectReferences>
</configuration>
</plugin>
这在您的属性中:eclipseTomcatServer必须与eclipse中的tomcat名称匹配
<eclipseTomcatServer>Apache Tomcat v7.0</eclipseTomcatServer>
并在您的个人资料中
<profiles>
<!-- profile to enable WTP in Eclipse -->
<profile>
<id>wtp</id>
<activation>
<file>
<exists>src/main/webapp</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>false</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<!-- WTP version -->
<wtpversion>2.0</wtpversion>
<!-- WTP server -->
<wtpdefaultserver>${eclipseTomcatServer}</wtpdefaultserver>
<classpathContainers>
<!-- Libraries from JRE -->
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<!-- Libraries from server container -->
<classpathContainer>org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/${eclipseTomcatServer}</classpathContainer>
<!-- Libraries from META-INF/MANIFEST.MF -->
<!-- <classpathContainer>org.eclipse.jst.j2ee.internal.web.container</classpathContainer> -->
<!-- Libraries from WEB-INF/lib -->
<!-- <classpathContainer>org.eclipse.jst.j2ee.internal.module.container</classpathContainer> -->
<classpathContainer>org.eclipse.jst.j2ee.internal.web.container/artifact</classpathContainer>
</classpathContainers>
<additionalBuildcommands>
<!-- JavaScript support -->
<buildcommand>org.eclipse.wst.jsdt.core.javascriptValidator</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<!-- JavaScript support -->
<projectnature>org.eclipse.wst.jsdt.core.jsNature</projectnature>
</additionalProjectnatures>
<additionalProjectFacets>
<!-- JavaScript support -->
<wst.jsdt.web>1.0</wst.jsdt.web>
</additionalProjectFacets>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
然后输入命令
mvn eclipse:eclipse
或
mvn eclipse:eclipse -Dwtpversion=[wtp version, usually 2.0 ]