When you use JBoss Tools, you can ignore the target directory. JBoss Tools AS server adapter deploys a project based on the WTP structure and doesn't use the target directory. You can create a mavenized Seam EAR project and use it as a template.
The target directory is used only if you call Maven build lifecycle using the m2eclipse's Maven content menu or command line.
But what happen with all the jar files? Because they will be only in the target folder and not with the source code.
JBoss Tools doesn't use the target directory. The JBoss AS adapter copies jars from your local Maven repository to the deploy folder using the Maven classpath container.
You can see that although they don't exist in the source code, they are in the deploy directory after deploying the application.
I think I'm doing something wrong.
If I remove the jars from the source code of the war project (ande keep all the M2_REPO/...jar in the buildpath), when I republish from jboss studio and I check the temporary folder (on Servers tab-> explore), there is no any jar in the war file inside the ear. Therefore, the jar were not copied to the deploy directory.
What I am doing wrong?
You shouldn't use the M2_REPO variable. You should define jars using the pom.xml file. The dependencies of the type compile, runtime will be deployed.
Don't forget to install m2eclipse-core, m2eclipse-wtp and the JBoss Maven Tools feature.