Jetty has been embedded in maven - java

when I use maven in my project, I dont install Jetty so is Jetty embedded in maven? how about others like Tomcat or glassfish

Maven itself does not embed Jetty.
There is this Maven plugin called: jetty-maven-plugin which embeds jetty for fast development lifecycle.
There is also a Tomcat Maven Plugin... you guessed it... it embeds tomcat... if you use the tomcat:run goal that is... it also has goals that will deploy to your own install of tomcat though so it does not limit itself to embedding.
I think there is a Glassfish Maven Plugin that does not embed glassfish but does provide goals to use an existing installation.
There is also the cargo maven plugin which can provision some containers and run application on those containers

Maven basically is a build tool, managing libraries and dependencies in a project. Jetty, Tomcat and Glassfish are Servlet Containers, that means Web Servers, that interact with Servlets (and Glassfish is even more, it's a full-featured Application Server).
That said, Maven does also download required libraries for you. I suppose Jetty is in your case among those libraries, so Maven "installs" it for you and even starts the Server when you run the project. More Info here for example:
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin
Tomcat and Glassfish would have to be installed manually as far as i know.

Related

How to deploy web application to existing Jetty using Maven?

Using mvn tomcat7:deploy I can deploy a web application to Tomcat. But how can I do this with jetty? As far as I understand it, the Maven Jetty Plugin launches its own Jetty server but can I configure it to use my existing Jetty server?
You can use the Jetty Maven plugin with either the run-war or deploy-war tasks.
http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#running-assembled-webapp-as-war

JBoss and IntelliJ - Use Jboss Plugin to run and deploy or use Maven

I am a newbie in setting up a Java EE application in IntelliJ. I manage to make it work and deploy it using the plain Run Configuraiton > JBoss settings. But I want to convert my project into a maven project. I would just like to ask the difference between:
(1)building and running a web/ear application using IntelliJ Jboss plugin and creating a server run configuration, and
(2)using maven + jboss maven plugin to build, deploy, and run the server
Can I use the features of the IntelliJ JBoss plugin if I deploy using maven instead (such as hotdeploy and viewing the output of the server directly in intellj)?
Thanks a lot!

How to deploy Java EE application using Jenkins CI?

I have Jenkins CI configured with a SVN repo of our Java EE based application.
I am able to build the application but I am facing problems while deploying the war. Actually I don't have any idea how to get a war file out of the build and deploy it to a remote Tomcat 7 server.
I need to deploy this code to Tomcat 7 in the form of a war deployment. Please guide me through any tutorial or docs.
If your build is Maven based, you could use the Maven Tomcat plugin. This will do more or less the same actions as the Jenkins Deploy plugin, but it will add a dependency on your build tool and not on your continuous integration tool.
There's a plugin for that: https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin
Basically, the deploy plugin will use tomcat's built in REST API/manager application to deploy the war file.
I use this in anger, and it's pretty simple. The plugin does everything you'll need for a simple situation.
If your needs are more complicated than this, you can script access to the management REST API directly, but I advise you to start with the plugin.

Best way to work with Java projects using Maven and Eclipse with embedded Tomcat?

I've run non-Maven applications on an Eclipse embedded Tomcat server before and I found the instantaneous deployment upon saving invaluable. However after starting a Maven project I didn't find any easy way to continue doing this.
Using WTP and the Dynamic Web Module Project Facet seems to wreck the project's Maven nature. Using JRebel is not possible in our company. Googling didn't provide any results that would work without again removing the project's Maven support. Is there any other way or am I doing it wrong?
Install m2elipse with WTP extension. Import your Maven WAR project. m2eclipse will configure Eclipse for and your can continue using your Tomcat in WTP.

How to start/stop/redeploy maven web app using cargo start inside Eclipse

I have Maven2 war project built, I'm using the cargo start plugin, and it works great for deploying the web app. To run the maven command, I use a .bat file in my workspace, and I have en external run config to run the the bat file. I can't seem to stop the server from the Eclipse console, or re-deploy.
Does anyone have any advice on how quickly start/stop/re-deploy to Tomcat locally while developing.
Did you try JavaEE tools and m2eclipse? As far as I can see it should work well in most common situations. What m2eclipse does for you is to exactly map the maven configuration to an eclipse projects with the necessary facets set. Also, if the Dynamic Web Application facet is set for your project, you will be able to deploy it to a Tomcat server that you set up in the Server view of JavaEE tools. This configuration allows hot redeploy.
More information on JavaEE tools:
http://eclipse.org/home/categories/index.php?category=enterprise
There is a full Eclipse distribution with the EE tools available on their download site:
http://www.eclipse.org/downloads/
m2eclipse is freely available from Sonatype:
http://m2eclipse.sonatype.org/
At work we use the mentioned software as well. Additionally we use the JBoss tools that provide a feature called Project Archives that let you individually build your web application archive (ear/war/...).
To get startet you should perhaps start a fresh workspace and import the existing maven project (via the import existing maven project wizard). If everything went fine you can set up your tomcat in the server view. Maybe switch to the Java EE perspective. Right click on the newly added server and select Add to add the dynamic web project you just imported. If it doesn't show up in the list try to update the project configuration via the project's maven context menu.
Well, you could use cargo:redeploy to Undeploy and deploy again a deployable (that's a shortcut to cargo:deployer-redeploy). But I personally don't use Cargo this way, I use it mostly for integration testing (i.e. during the build) and use Eclipse WTP during development (this works whether you're using the maven eclipse plugin or m2eclipse).

Categories