-
1. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
jjfraney Aug 15, 2011 12:51 PM (in response to wolfgangknauf)My experience disagrees with: "E.g. a project, which has Maven support, will not be deployable to the Application Server by Eclipse."
I am using m2eclipse-wtp. Are you?
-
2. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
wolfgangknauf Aug 15, 2011 6:06 PM (in response to jjfraney)Hi John,
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.
Best regards
Wolfgang
-
3. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
jjfraney Aug 15, 2011 7:18 PM (in response to wolfgangknauf)Deploy using WTP.
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).
-
4. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
wolfgangknauf Aug 16, 2011 5:42 PM (in response to jjfraney)This sounds promising - I will give it a try next week (I am on vacation for some days).
Does this also work with an EAR project cointaining multiple modules (EJB, WAR, AppClient)?
Best regards
Wolfgang
-
5. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
jjfraney Aug 16, 2011 7:56 PM (in response to wolfgangknauf)Multi-module projects work, too.
I'm using this structure:
app-parent
module: app-ear
module: app-war
module: app-ejb
In app-ear/pom.xml, maven can be configured to generate the applications.xml file (or not).
It can be made to work, but some maven projects won't import well. I've stayed close to convention and have been successful so far.
-
6. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
wolfgangknauf Aug 22, 2011 11:32 AM (in response to jjfraney)Today I found the time to take a look at this again. Do you use this plugin: http://community.jboss.org/en/tools/blog/2011/08/01/m2eclipse-wtp-0131-back-to-the-m2e-marketplace ? If yes, I should start using JBoss Tools ;-).
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 ;-).
Best regards
Wolfgang
-
7. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
jjfraney Aug 25, 2011 3:44 PM (in response to wolfgangknauf)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.
-
8. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
wolfgangknauf Aug 28, 2011 4:05 PM (in response to jjfraney)Hi John,
thanks for the reply. So I installed JBoss Tools and found this archetype: https://docs.jboss.org/author/display/AS7/Creating+your+own+application
Using this archetype "jboss-javaee6-webapp" created a project with all required facets, but AS7 dependencies. I will do some more research, but up to now it seems quite nice.
What archetypes do you use? Do you know any ones which create the other JavaEE modules (EJB project, app client, EAR with multiple modules)?
Best regards
Wolfgang
-
9. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
wolfgangknauf Sep 2, 2011 3:57 PM (in response to wolfgangknauf)Just for the records: I spammed the JBos tools forum: http://community.jboss.org/thread/171614
I think I will have to start learning Maven at the beginning...
-
10. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
wolfgangknauf Sep 9, 2011 4:05 PM (in response to wolfgangknauf)I updated my sample: it now starts with a section "using "m2e(clipse)-wtp and an archetype to create web app and test", my own "workaround" is section 2 of the sample.
Is this "better" / more compliant to the Maven way now ;-)?
Thanks for your feedback, John!
Wolfgang
-
11. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
jjfraney Sep 11, 2011 12:54 PM (in response to wolfgangknauf)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.
-
12. Re: Tutorial for JSFUnit2 + JBoss 6 + Eclipse WTP
wolfgangknauf Sep 16, 2011 3:32 PM (in response to jjfraney)Thanks for your comments again!
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 ;-)
Best regards
Wolfgang