Note that I tried to use the Eclipse functionalities for developing and deploying JavaEE applications as much as possible and to use Maven only for places where there was no way around it ;-). This caused a bit of struggle to combine them both, but in the end it worked: I use Eclipse JavaEE project types, and only the test project is a Maven one.

do you deploy by using M2Eclipse or by using WTP (right click => "Deploy to server")? I assumed that the latter would not work, because WTP does not know about the changed structure of a Maven project. But maybe I just picked a wrong archetype?

I am a Maven beginner, so there are probably a lot of improvements to my tutorial.

The secret sauce in m2eclipse is pretty simple. When you 'Import a Maven Project' (Import->Maven->Existing Maven Project), m2eclipse reads the pom and sets the build properties of WTP and Java natures. For example, if your pom specifies a java 1.6 source and target, m2eclipse sets the right property in the java builder of eclipse. Same effect with m2eclipse-wtp. Your pom indicates war, ejb or ear package, which tells m2eclipse to adjust wtp builder from the pom values. If your pom does not redefine the default source directory, m2eclipse sets the wtp source directory to src/main/java. m2eclipse-wtp will also mark the project 'deployable' which makes it a candidate for 'deploy to server' (BTW, the path I usually take to deploy is to right click on the server and select 'Add/Remove...')

The conditions for successful import is to have m2eclipse, m2eclipse-wtp, and your pom must show a j2ee package type (war, or ejb).

What archetype do you use to create the projects? According to this tutorial (https://docs.sonatype.org/display/M2ECLIPSE/WTP+mini+howto ), it should be "maven-archetype-webapp". After this, I saw a "Dynamic web project" was created. And after some more struggling, I managed to set the required facets. But my managed bean didn't work. So, before digging further, I want to confirm that I installed the correct stuff ;-).

In some cases, I don't find latest plugins on marketplace. Marketplace is convenient, sure, but not always latest. I go to the project pages and confgure their update sites into my eclipse. Less convenient, yes, but almost always freshest.

I install plugins from m2eclipse and jboss tools projects. The latest available are the 'right ones'. Note that jboss tools has several 'maven configurators' which you should review and determine for your self if they apply to your projects. These will add facets as needed during import and is worth the added effort of installation.

The tutorial you quote is 3 years old. That doesn't automatically disqualify it, but it is long of tooth, as we say. The artefact is not complicated and ought to work. However, the artefact might be old, too, and may be using java 4 source/target, or a servlet api that is 'long of tooth', too. You can prove to yourself that maven by-command-line builds the project correctly, first. Then use m2eclipse import feature to pull the project into the eclipse IDE.

You will likely get more help on an m2eclipse forum at sonatype, or a jboss tools forum at jboss, than here on jsfunit.

This is more in line with how I expect things to work with eclipse and maven.

I'd throw in one more comment. You have a warning that the 'JSF' project has to be added in manually as an eclipse dependency of the 'JSFtest' project. This won't be necessary if the dependency is in JSFtest's pom.xml file:

<dependency>

<groupId>JSF</groupId>

<artifactId>JSF<artifactId>

<version>0.0.1-SNAPSHOT</version>

</dependency>

Eclipse m2e plugin is smart enough to find this project in the eclipse workspace and add it to the 'Maven dependencies' for you.

However, the command line maven won't have such workspace awareness. Running from command line, it would be necessary to remember to run 'mvn install' for the JSF project, before 'mvn test' in the JSFUnit project. This is best resolved with a different project structure, instead of having two separate, isolated maven projects, JSF and JSFTest, make these submodules of a multimodule maven project.

The "dependency" you suggested will not work in my "version 2" sample, because my JSF project is not mavenized and thus M2Eclipse cannot resolve it. So, version 1 of the sample is probably the better way. And maybe I will find a way to create a full EAR project one day ;-)