Configure tomcat runtime using maven - maven

Is it possible to configure a complete tomcat runtime within Eclipse using Maven/m2eclispe.
A maven goal to downloaded tomcat, create the server withing the eclipse environment and add the specified war files to the server ?
Or can some of these goals be implemented ?

You might want to take a look at this solution or check out the maven cargo plugin.
The first solution uses the sysdeo tomcat plugin, which I've personally used in the past, which worked quite well. It does not download tomcat though for you. You will have to do that manually.
Right now I'm working with the maven cargo plugin (not an eclipse plugin though), which will download a tomcat instance for your for development purposes.

Related

How to Deploy an artifact programmatically using Maven

I have a mission to develop an integration tool which allows from a source code folder to generate a WAR or OSGI Bundle and then deploys it in Tomcat or Karaf. I used Maven Embedder to create the artifacts, now my problem is how to configure my pom.xml to automatically deploy these artifacts.
on the internet I can't find any examples and also I'm new to the world of JEE and Maven.
please help me.
Find out how you can deploy artifacts to Tomcat or Karaf (without Maven).
Find out how you can deploy artifacts to Tomcat or Karaf programmatically.
Find a Maven plugin to use that deployment method.
The simplest solution would be to use something like the maven-resources-plugin to copy your built artifacts to the servers deployment directory but I am pretty sure that there are more sophisticated methods like http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/deploy-only-mojo.html for deploying out of maven without plain file system mechanisms.
On a wider scale when working on problems like yours it always helps to take a step back and think about the abstract use case ("How to deploy something somewhere" followed by "How to deploy something somewhere programmatically") before going into detail and think about Tomcat or other application servers - and in most cases you will find out that there were hundreds of other who already had the same problem and solved it some way or the other.

Can JRebel reload Kotlin classes when they are used by kotlin-maven-plugin plugin on maven?

Can JRebel reload Kotlin classes when they are used by kotlin-maven-plugin plugin on Maven?
The project runs on an application server.
JRebel will reload kotlin classes provided they are compiled either via IDE or manually by invoking maven compile.
Also the classes must either be compiled to the path specified in the rebel.xml or to the classloader's classpath(e.g. when using exploded deployment with target/classes or target/artifact-name/WEB-INF/classes as the root).
Usually achieving this requires no extra steps and it should be just: Enable JRebel -> Start server & deploy application -> Make changes -> make/compile to reload
If you have not done so yet, please try the free trial at https://zeroturnaround.com/software/jrebel/trial/
and report back any issues and suggestions to support#zeroturnaround.com

Classes not getting published to embedded tomcat server of maven (tomcat:run)

I'm using eclipse indigo IDE, apache tomcat 6.0 server, m2e plugin,jdk 1.6 softwares in my project.
After i make some changes in java code i do clean & maven build and the start the tomcat embedded server using maven i.e. 'tomcat:run' plugin command. But after following all steps i don't see my changes reflecting at all.
Now after i build all classes i see that all the class files are generated inside 'target' folder which i confirmed with the time at which it was generated.So i believe these class files are not getting published to embedded tomcat server of maven for some reasons.
P.S - I don't start/stop or use tomcat server configured in eclipse as i believe embedded tomcat server of maven doesn't use tomcat server in eclipse and it works by itself.Please correct me if i'm wrong here.
Please help me out.
[Update]:
Might be useful for someone who is facing similar issue.
The above problem was because of eclipse project settings file getting corrupted as i was encountering the same problem when i imported the same projects in different workspaces.But when i included modified codes alone in new workspace,it worked fine. All my changes were getting reflected.
use tomcat7:run
Then configure backgroundProcessorDelay see http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/run-mojo.html#backgroundProcessorDelay with > 0

Jacoco w/ Jetty + Selenium RC

I come back here because I have some kind of problem. (I posted 2 or 3 questions before about a project I'm working on, this question is still related to this project)
So I have a smartGWT webapplication which I build using Maven. To unit test it, I had to use Selenium RC (to be able to use the user-extensions.js provided by smartClient), and as it must be compatible with the continuous integration, I had to deploy the webapp on a Jetty container. Now I only got one problem left :
How can I use Jacoco with Jetty to make Sonar recognize my tests and give me code coverage ?
Is there a property in the jetty-maven-plugin that allows me to run the jacoco-agent each time the application is deployed ?
Thanks in advance, one more time =)
(Sorry for my bad english)
It seems that your only option is the cargo plugin.
As described in the link to the duplicated question Jetty is executed in the same JVM as Maven.
So if JVM options are not possible you have to use the cargo plugin.
The maven-jetty-plugin has recently added support for running jetty in a separate JVM, ala cargo, so you might be in luck: http://jira.codehaus.org/browse/JETTY-991. Otherwise you can use cargo (that is what I do).

Automatic deployement with Jenkins/jetty

I would like to setup a continuous integration environment whereby after committing the source code, it triggers a build process that checks out the code, runs tests, constructs a war file and deploys the same to jetty server such that the users/testers can access the application on the browser.
Is this possible ?
Am using maven and jetty (I am not willing to change this. I use jetty both for development and in production). For CI, I am exploring Jenkins but am open to other opensource solutions.
If possible, how do I setup the environment.
I found a maven plugin named cargo. It has everything that I needed. I added it into my pom so that I could deploy and undeploy using mvn cargo:deploy/mvn cargo:undeploy. I created a new jenkins job and added undeploy, package deploy maven goals as build steps. Everything is working perfectly.
it's definitely possible. In a previous project, the build server (teamcity) copied the war to a shared nfs location between the build server and the application server and run a little shell script that connected to the application server and restarted jetty.
We used ant inside maven to manage the deployment, I remember we used the copy and sshexec tasks.
I'm sure that there are many other solutions, but that one worked for us.
I reviewed a lot of posts like this but I want something that is maven independent. Look here, this is selfcontained runner in on hudson/jenkins. You only need 'war', even manual jetty installation is not needed. Deploy war on jetty in Jenkins or Hudson job

Resources