Make Jenkins Build a SUCCESS After successful Spring-boot run - maven

I have CI system using Jenkins that automatically clones a repository,
then runs mvn clean install and then mvn spring-boot:run (using windows batch).
My problem is that the Jenkins Build does not stop even though the spring-boot:run is successful.
Is there any way to work this out?

I found a workaround for this.
I added a Build Step that executes a Windows Batch file as a child process
but before starting the batch process, I changed the BUILD_ID to something like BUILD_ID='NO_DELETE' so that Jenkins won't automatically kill it.

Related

execute command mvn clean install failed when integrate with Jenkins

I try to build Jenkins with maven project and in goal I defined: clean install.
But it failed with the below reason:
I try to execute the command mvn clean install in command line but it works fine even with eclipse IDE.
I also check the network and see I can connect successfully.
Any solution in this case.
By default, Jenkins can't access the internet if you are under Proxy. So please configure proxy in jenkins. Here I am attaching a link to configure the jenkins. Hope this helps. If anything comes up, please comment below.

Is it possible to have a maven build write a file when it fails?

I have a maven build running in a Jenkins job.
I need to do some post-processing stuff after the maven build but during the job, and so I'm running mvn with the -fn (--fail-never) option (jenkins will halt the job immediately otherwise).
The catch, of course, is that if the maven build step failed, I need to fail the job in a subsequent build step.
In the past I've done this sort of thing by writing a file to a certain location if the build failed, and then using the Ant task to fail the build. So this is the approach I'm going for.
Is it possible to get maven to write a file on build failure?
Instead of using the maven runner in Jenkin, you could execute the build as a shell script, then do something like...
mvn -q -fn clean verify || touch build_failed
I would suggest to use the configuration jenkins is capable of. Running a post-build-action in case of successful execution of the build and don't use --fail-never option.

Jenkins Inegration with TestNG.(when running from jenkins it's not invoking browser)

My project contains (Webdriver,Maven3.05,jenkins) when I run maven command "mvn test" , test will trigger and browser will be invoked, the same set when i had configured using jenkins it will run the tests but browser will not be invoked.Please help me where iam going wrong.(I had installed testng plugin for jenkins all necessary configurations are taken care).
Try starting jenkins using the command line:
java -jar jenkins.war
Usually in Windows not all the services are allowed to use the interface
Hope helps!

How do you debug Maven plugin tests executed with the maven-invoker-plugin?

I would like to attach to some tests for a Maven plugin being executed with the maven-invoker-plugin. How does one do this? I can't seem to find any resources and it doesn't seem to be by simply doing:
MAVEN_OPTS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9001" mvn clean install
I mean -- I can connect this way, but when the maven-invoker-plugin starts, it just sits there. Forever...
Any help would be appreciated.
You must be aware that maven-invoker-plugin invokes a separate instance of Maven for running integration tests like a manual call of mvn with the appropriate configuration options. That's the reason why maven sticks...
You can put the appropriate options into invoker.mavenOpts or into a invoker.properties file.
An other option would be to change the mavenExecuteable and use mvnDebug instead of mvn.
Apparently, (after further inspectiong of the build.log) with the above mentioned way, it freezes simply because Maven is waiting for you to connect with a remote debugger a second time -- this time for the forked process.

How to conditionally run maven-release:rollback in jenkins?

I am using jenkins/hudson to make maven releases, and sometimes when the builds fails, I have no other way that manual to rollback and then start the jenkins build again. I was wondering if there is any good and configurable way of running mvn release:rollback in the end of the build dependent the result of mvn release:prepare? I mean, if the release process fails, I want to run maven release:rollback, otherwise not.
Thanks your time.
You can configure your Jenkins job to do a fresh checkout of the source code every time the job is started. So if your release fails before the creation of the release tag, you can fix the problems and just start the release again.

Resources