Summary
In Eclipse, when I "Maven->Update Project Configuration" "Maven Dependencies" gets removed from the "Deployment Assembly" of my project.
Details
I started with a pre-configured Eclipse project: File->New->Dynamic Web Project->JavaServer Face v2.0 Project. To remove the "magic" I then converted it to a Maven project: Configure->Convert to Maven project.
pom.xml contains the following:
<build>
<finalName>jsf-facelets-tutorial</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>WebContent/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.0.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.0.5</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Then, to make sure the Maven dependencies are copied to "WEB-INF/lib/" before deploying, I added them to the project's "Deployment Assembly": Project Properties->Deployment Assembly. For more details, see this question: Eclipse + Maven + JavaServer Faces -> ClassNotFoundException: StartupServletContextListener.
I know have two related problems.
Problems
(1) When I "Project->Maven->Update Project Configuration", "Maven Dependencies" gets removed from my "Deployment Assembly". Is there a way to stop this from happening, possibly via some Maven plugin?
(2) When I build the .war from within Eclipse everything is fine, the .war runs fine in Tomcat. But when I build it from command line with Maven, mvn clean compile war:war
, the .html files from "WebContent/" is not added to the .war. Again, Which Maven settings/plugins do I need to remedy this?
FYI, it's a very basic application... just a login page and a welcome page.
If there are any additional details I should provide (web.xml, faces-config-xml, login.xhtml), let me know and I'll add them.
Thanks
--EDIT--
Eclipse version: 3.6.2
Eclipse m2e version: 1.0.1
Apache Maven version: 2.2.1
(1) Solution
Updated to Eclipse Java EE 3.7.2 (Indigo). Now also using m2e-wtp Maven Integration for Eclipse WTP plugin
(2) Solution
Created new Maven project from archetype, then Eclipse->Import->Existing Maven Project. With new Eclipse version and the m2e-wtp, the Java EE perspective in Eclipse works well with the standard Maven directory structure
The pom.xml is now simpler too:
<build>
<finalName>jsf-facelets-tutorial</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.0.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.0.5</version>
<scope>runtime</scope>
</dependency>
</dependencies>