I make my first steps with arquillian. I just setup a java-ee project (using wildfly ear archetype).
The pom delivers 2 profiles: "wildfly-arquillian-container-managed" (only runs if JBOSS_HOME is properly set) and "wildfly-arquillian-container-remote"
Both are running fine. But how to run them in Eclipse? I read here "and select Run As > JUnit Test " but this yields
DeployableContainer must be specified
But i also found "Arquillian Eclips". It should provide "add Arquillian support and "run as Arquillian JUnit test". I installed JBoss Tools in my Juno but can't find any "arquillian".
So how to run Arquillian test from within Eclipse?
The maven profiles activate a container adapter. When you run them the container adapter can start wildfly.
When you run your test in Eclipse you have to add this container adapter to your class path. When you then choose Run As > JUnit Test it will take this container adapter into account and run wildfly.
I found jboss-Tool's arquillian-eclipse:
Via help->install new software
Choose "http://download.jboss.org/jbosstools/updates/stable/luna/" as update site. You'll found arquillian support in "JBoos Web and Java EE Development".
This will bring among other things "run as arquillian test". It will configure maven (pom) and will setup test run targets.
The option which works in every IDE I know is to select the default Maven profile to run.
With Eclipse it's available from Project | Maven |
Select Maven Profiles. Choose the Arquillian Managed profile as an example.
Then, in arquillian.xml file configure the location where JBoss/WildFly is installed.
Source: Running Arquillian from Eclipse
Related
I have maven based project with following structure:
main_project
module_webproject
module_java_proj_1
module_java_proj_2
module_java_proj_3
... ...
Everything compiles and packages fine with command line maven goals execution. I need to setup this project into eclipse environment for developers with tomcat deployment. Anyone know setup instructions?
Also, i am looking into tomcat hot deploy for debugging capabilities.
I have tried mvn eclipse:eclipse, this does only creation of .project and .classpath files. But projects directories are not treated as java or web projects.
Answer from following forum some what helps...
[Running Maven project on Tomcat from Eclipse
There can be a few reasons why you don't see the project in the Add/Remove projects dialog for Tomcat. Verify the following:
You have m2e installed (http://eclipse.org/m2e/download/)
You have m2e-wtp installed (http://www.eclipse.org/m2e-wtp/download/)
Your Maven project imported as a Dynamic Web Application. Look for a Deployment Descriptor entry when you expand the project, it should be somewhere in the first few entries. It is the second one down for me on Eclipse Juno. Not there? It's probably not a web app. Go back and verify 1 & 2, then remove and re-import your project.
Make sure that your web application is not too new for the version of Tomcat that you are using. Right-click the project and go to Properties > Project Facets. Look for Dynamic Web Module and check the version. If this version is too new for your Tomcat version, Eclipse won't let you add it. For instance, your Dynamic Web Module version is 3.0 and you're using Tomcat 6.
When using Eclipse for your Grails projects the building of the war seems to be stuck in production mode.
If you want to deploy to an attached tcServer you simply right click on your project then choose “run as” ->“run on server”.
If you have your grails project set to “dev” (right click on your project then choose “properties”->”grails”->”run on server”) then you would expect the project to build a development war.
You’d be wrong. You get a production build.
How do you get a eclipse to build a development war?
Each Grails command has a default environment, e.g.
grails run-app => dev
grails test-app => test
grails war => production
You can override this default by supplying an argument -Dgrails.env=<environment>. So to build a war for the dev environment, run grails -Dgrails.env=dev war
Don, What you say is correct for the command line. I'm referring to Eclipse.
I have solved the problem.
It seems there is a bug in Eclipse. If you want your app built (through Eclipse) as development then set the “dev” to “test”.
As it stands with you cannot get Eclipse to build a dev war.
The version of eclipse I am using is Version: Indigo Service Release 1 Build id: 20110916-0149.
I have a Maven project which is a web project and is packaged as a war.
I use tomcat-maven-plugin v1.2-SNAPSHOT to do a tomcat:deploy when i want to deploy.
But my question is how do i debug it / set breakpoints like i can do for normal web projects in eclipse (where a Debugging perceptive is shown and the server is paused.)
(i am a noob in this field)
[EDIT] I am not asking how to deploy to TOMCAT. i am rather asking how to setup the debug mode .FYI i am not able to right click on my project and select run> run on server, even though i have generated WTP specific files through maven.
mvn tomcat:deploy deploys an app to an external Tomcat server. If you want to debug that, you'll need to run that Tomcat server with debugging enabled and set up a remote debugging profile in Eclipse.
Edit: There's a succinct guide to doing this on the Tomcat wiki. The simplest approach is to start Tomcat with catalina jpda start. That will start Tomcat in debug mode listening on port 8000 for debugger connections. Then in Eclipse, you create a "remote" launcher configuration and tell it to connect to localhost:8000.
It doesn't matter whether you deploy it with maven or with Eclipse WTP as long as you started the server to which you deploy from eclipse and eclipse knows where the sources of the code you deployed are placed.
Keep attention if you have set the CATALINA_HOME environment variable, this will used to deploy to with mvn tomcat:deploy. But you can also define this in the configuration of the pom.xml.
<configuration>
<url>http://www.mydomain.com:1234/mymanager</url>
</configuration>
I'm not sure that it is feasible through the Maven plugin.
But you can generate eclipse specific files: mvn eclipse:eclipse -Dwtp.version=2.0 (The WTP version depends on the WTP version of your Eclipse).
Then, you can update your project and deploying it into a Tomcat like you can do for normal web projects.
This solution worked in my case, you can try this
Add module to Server
Go to the Servers view.
Double click on the Tomcat server.
You will get the server editor view.
Click on Modules tab in view (at bottom)
Click add External Web Module enter the path to your built files (e.g., C:\svn\projectName\trunk\test\project\target\webapp) and give a path.
Save.
Debug Server
Right-click on Tomcat in Servers view.
Choose Debug.
Debugging Startup
If you are debugging the startup of your application you might need to increase the startup timeout in the server view.
Thanks.
I'm working on a Maven project in Eclipse, where I'm using Maven (mvn install) to create my WAR file and run it on my Tomcat server. However, every time I change my application, I have to execute mvn -o compile war:exploded and sometimes have to restart Tomcat.
Is there any other way to simplify this long and heavy process?
You may start using:
m2e ( maven to eclipse integration ) -> http://www.eclipse.org/m2e/
Eclipse WTP ( web tools platform ) -> http://www.eclipse.org/webtools/
WTP will allow you to run Tomcat from eclipse and m2e will take care of converting your Maven build into Eclipse project and integrating it with WTP.
If you are using eclipse then you need not to use mvn -o compile war:exploded every time. But yes, you need to use mvn install each time you make a change in your application.
This is what you need to do:
Open Server View
Open expected tomcat server settings. A settings window for tomcat will be opened.
Select modules tab.
Choose Add external web module. An input form will be opened.
Browse to your application's target (generated by maven) folder and then select already exploded war directory and set it as Document Base
Enter Path as the base url for your application.
This is just one time effort.
I have a maven build Java project.
My war file name is: test-1.0-SNAPSHOT.war
I am using M2E plugin in Eclipse.
I have run target mvn package.
Added server as tomcat version 7 in eclipse indigo 3.7. Server started. But my war file didn't deployed in the server.
I have tried by right clicking tomcat server and Add remove..., it says "there is no resources that can be added or removed from the server".
How can i deploy my war file in the eclipse WTP tomcat server?. Do i need to run any maven target?
Make sure that you have "Maven Integration for WTP" installed in your Eclipse instance.
First check if it's available through
Window->Preferences->Maven->Discovery->Open Catalog
If for whatever reason this does not work, you can get WTP integration from this update site (that's the version I am currently using):
https://repository.sonatype.org/content/repositories/forge-sites/m2eclipse-wtp/0.13.0/S/0.13.0.20110623-0455
This integration does a lifecycle mapping of maven-war-plugin into m2e architecture.
Once you've installed the WTP integration, you must restart eclipse and once it's restarted, right click on your web app project and choose: Maven->Update Project Configuration...
Also, I would advise to run a clean build at this time.
Last, but not least, delete and recreate your Tomcat server configuration (I don't know why, but I had to do it quite a few times when I switched to m2e).
I think eclipse is not recognizing your project as a web app, To confirm this
Open to do open J2ee perspective on your eclipse, If you open the project folder of your app, You should see (Deployment Descriptor)
If you don't see it, your app is not web app as far as eclipse is concerned
I have see this in case if you imported/created a maven command line project
To fix this
Select Project ==> Properties ==> Project Facets ==> make sure Dynamic Web Module check box is checked
If you do that the local tomcat server will add your app when do add remove projects
I think eclipse is not recognizing your project as web app,convert your project into web app by command mvn eclipse:eclipse -Dwtpversion=2.0 and try to deploy in Eclipse configured tomcat,it will work.
If you have Eclipse 3.5 or above you should ensure that you have both the m2eclipse (m2e for 3.7) plugin installed and its WTP add-on. With these you shouldn't need to change your configuration by hand.
Did you try to build your project from the command line and deploy it in Tomcat by hand?
By the way, have you read this wiki post? It's a bit old, but it may still be relevant.
Adding 2 cents to Prasanna wonderful solution.
I realized that building maven war files "mvn package" was just creating .war file but eclipse was not picking up that war but was deploying its some internal version of it's app war.
I found that server > Browse Deployment Location.. in Eclipse server view .. it was taking to some abstract location like "C:\Programs\workspaceSTS.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps"
Where I could see my exploded app deployed but it was not having any /classes folder just limited files.
Using Prasanna's method I realized that eclipse now was deploying full exploded .war now.
So this was happening coz changing the facets to Dynamic Web Module has actually populated "R-click project > Properties > Deployment Assembly "
This Web Deployment Assembly window only tells eclipse what to deploy and what not. So even if your project is NOT setup as Dynamic Web Module , and still if you configure "Web Deployment Assembly" values properly , eclipse will deploy the app fine to Tomcat/ Server.