Maven and Eclipse, war appears as a jar
I have a problem with maven and my eclipse (helios). I have created a war project with maven like this:
mvn archetype:generate -DgroupId=net.myproject.front -DartifactId=personnes-front -DarchetypeArtifactId=maven-archetype-webapp
Maven have created all the directories arborescence and the pom is for a war project:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.myproject.front</groupId>
<artifactId>personnes-front</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>personnes-front Maven Webapp</name>
<url>http://maven.apache.org</url>
</project>
When I run a mvn clean install command, a war is created by maven.
Now, in my eclipse, my project appears as a jar and I can deploy it in my jboss 6. Jboss 6 is integrated in eclipse by the jboss tools.
I don't understand why my project appears as a jar for eclipse.
Some开发者_如何学Cone can help me ?
Thanks.
In order to convert the project into a Dynamic Web Project (Eclipse Web Tools Project - WTP) you need to have Eclipse Java EE edition, or have installed the WTP plugin. Assuming this is already the case, you need to define the eclipse plugin in your pom
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
When using the m2eclipse, you should update your project configuration by right-clicking on the project and select "Maven - Update project configuration". That should generate the necessary eclipse meta files (located in the hidden .settings folder) to help Eclipse interpret this project as a web project (using the WTP plugin - Dynamic web project).
When not using the m2eclipse, running mvn eclipse:clean eclipse:eclipse from a command prompt will also generate those meta files in .settings, causing eclipse to see it as a dynamic web project.
See the eclipse plugin page for more info : http://maven.apache.org/plugins/maven-eclipse-plugin/plugin-info.html
精彩评论