I've deployed a servlet based web application(War file) in Tomcat server using Jankins and Maven. Now I want to run some selenium automation scripts on same application, Can it be achieved by Jenkins.
Its like Deploy web application on Sever and once deployment is successful run automation scripts using jenkins..
Please Help..
Two possible ways :
1) Add post build step to your current task and run the scripts there.
2) Add another task ex. "app-automation-scripts" that runs every time that your current task is builded correctly.
Yep,
you can add maven plugin to jenkins, (installed by default most of times)
then declare your project as war in pom.xml
then add a post processing "maven" to your maven build config and configure it with options "war:war"
-- options you can add for a maven build is: clean install build and etc. war option is for creating war files.
Or:
simply run a bash command using your jenkins build configuration.
Former needs installation of maven plug-in and configuring it,
Later needs configuring your maven to be run on the jenkins server by user named "jenkins".
Related
I'm really nooby in 'Continuous integration'. And have a question about it.
Is it possible to create jar, ear or war file and deploy it on jboss every time I merge my develop branch (release) with master branch. I user gradle for build my project. I prefer something without user interface. My server runs on ubuntu server.
You should use a build server (like Jenkins) that could be configured to poll your git repository and run the build upon commit and on a successful build it would deploy (by a script or some plugin) the build product (jar/war) onto your JBoss server.
I have a scheduled build in Jenkins which runs everyday at 12:00 AM. I want to set up a CI server for my project. I want to set it such a way that before every build, my application is undeployed and once the build is successful, it's deployed and up again, running on the server. This is possible if I manually add some server in my system and put the shell command in pre-build and post-build actions to undeploy and deploy manually but is it possible directly with Jenkins? As the name suggests, Jenkins - CI server, is there any way how can I do it with Jenkins?
Note: I have maven jetty plugin and have set a goal clean install jetty:run in my application but it doesn't suit my requirement in Jenkins for CI server.
Yes, Jenkins will run any script at any time, so you can do this very easily. You don't need to use pre- and post-build actions. Build steps work very well for this use. You can add multiple steps to a single Jenkins job/project.
How to run Maven as soon as my server boots?
Is it OK to have a script executed using cron once the server run? or is this a bad practice?
I am using Jetty and Resteasy and running them on Maven to start my webserver.
What is the best solution for when my server starts, Maven automatically starts?
The command is use is:
mvn jetty:run -e
EDIT:
I am using Amazon EC2 to launch an instance and I would like to have the maven build to run as soon as an instance is launched.
Maven builds and runs Resteasy, Jetty and a bunch of other dependencies that are stated in the pom.xml file.
You can use your OS specific init scripts approach. A very good answer for Ubuntu OS can be found here.
Usually, you use Maven as a build tool, not a deployment tool.
What are you trying to accomplish? If you just want to boot Jetty, it comes with its own init scripts which will start it on boot if you enable them.
Unless there is a convincing reason to use Maven for this, I would have your Maven build process create an "executable unit" such as an executable JAR, a WAR, etc. and then boot that at startup instead.
we recently migrated to Maven Build manager & git hub repository for our Java web-app. Also i switched to eclipse as eclipse has good set of plugins.
As a new bie, i am simply running mvn clean package from terminal at the code root directory. And then moving the compiled code i.e., /target/SNAPSHOT/* to tomcat/webapps/ROOT location.
And then starting Tomcat7 server. The process is time taking especially when i do code changes in Java & configuration .xml files.
I want to do it completely in IDE environment as i did earlier in Netbeans, update code -> build and run in debug mode, -> do code changes and then commit.
Heard of egit & m2e in eclipse for maven & github integration, but not sure how to use it.
Please walk me through the steps required in doing so. I am completely new to eclipse.
--
Thanks
You might want to consider using maven-jetty-plugin http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin for running the webapp. You will not need to copy over stuff to tomcat. After configuring this plugin, you can simply run your application by doing mvn jetty:run
I generally do not like running webapps inside Eclipse. It's a personal prefrence, but it is always nice to have an IDE neutral way of building and running your applications. If you have m2e things should work simply fine. I have seen maven-jetty-plugin having hot pluggability where if you changed your web.xml, jetty would reload your application.
We use Git for version control and Maven for dependency management and build automation. Once your project has successfully imported into Eclipse and recognized as a valid java web project, you don't need either Git or Maven in order to build/run it inside IDE. Just creat a server using you existing tomcat installation, add the project to server, then select Run as > Run on Server.
The Complete Guide:
Creating a server
Adding projects to a server
Starting a server
For more details, check out Testing and publishing on your server.
I am using eclipse with maven2 plugin.
When doing a Run-As -> build with a goal of 'deploy' I am getting this error:
Error message:org.codehaus.plexus.component.configurator.ComponentConfigurationException: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
I'm not sure I even need to do a 'deploy', I have another build that does a 'compile' goal, and from what I have learned doing a Run-As -> Run on Server (tomcat) is enough to deploy my application locally to tomcat.
Do I need run this build 'deploy' goal to run locally, should I just delete it and use 'run on server'?
Running mvn deploy won't "deploy your application on Tomcat", deploy is something different here, deploy is a phase done in an integration or release environment and copies the final package to the remote repository for sharing with other developers and projects.
In other words, unless you are dealing with a remote repository to distribute your application (and this requires to configure a valid <distributionManagement/> section in your POM), just forget about deploy for now, this is not what you think it is :)
So, to run your application and "deploy it on Tomcat" from Eclipse, use Run As > Run on Server. If you want to run it from outside Eclipse, you can use mvn tomcat:run but this isn't really appropriate here (this goal is an handy way to run a webapp without importing it in a IDE). And if really you want to deploy your application on Tomcat from the command line, the Maven Tomcat plugin supports many methods for Deployment. But again, I don't think that this is what you're looking for for now.