I am having error “Could not parse build number : ${${build.number}} while executing maven / java project through Jenkins.
If i run directly through Maven it works.
Any idea what could be the cause of this issue?
Thanks
You can refer the build number directly like,
${BUILD_NUMBER} instead of ${${build.number}}
otherwise you can pass it from goals and options sections.
clean install -Dbuild.number=${BUILD_NUMBER}
then you can refer it in POM like ${build.number}
Use ${env.BUILD_NUMBER} instead of ${${build.number}}
Related
So I am having trouble uploading our dotCover results from Jenkins to our Sonar instance. We are using the SonarScanner for MSBuild plugin. All of the documentation I have found like here: https://docs.sonarqube.org/pages/viewpage.action?pageId=6389770#CodeCoverageResultsImport(C#,VB.NET)-dotCover
Shows how to do it from the command line. We are using the plugin. There is an area for additional arguments that I have added what I assume is an added argument like on the command line. Here is how I have it set up:
So that is the argument that everything shows to add to the end of the command line portion, but for some reason it doesn't add coverage to Sonar. Does anyone see anything obvious I am missing here? I have been stuck on this for a while. Thanks!!
So as it turns out I had:
/d:sonar.cs.dotcover.reportsPath=
It should have been with an s at the end:
/d:sonar.cs.dotcover.reportsPaths=
I have installed Jenkins, create a project and configure it.
I run into a problem, Jenkins do everithing great except documentation generating.
Could anyone point me where I have done mistake, and how fix it?
Thank you.
------------------------ New information ----------
Console output:
I have renamed doc to javadoc directory, but it isn't help.
Here is screenshot of javadoc directory contents in console, it is clear that Jenkins plugin didn't generate documentation, but why?
It sounds like you are expecting the Jenkins plugin to produce the documentation. The Jenkins plugin merely copies files from the job's workspace folder to the build's archive area and provides a link to it. If your build steps don't produce Javadoc, then Jenkins won't be able to archive and provide a link to it.
Does your pom file include the maven-javadoc-plugin?
Are your build steps invoking a goal that includes Javadoc generation?
For example, "mvn jar" would compile Java and build the jar but not build the javadocs. Clearly you have executed a goal that executes the tests and provides a code coverage report, but that does not trigger the Javadoc goals either. You would need to make sure your build steps include a javadoc goal - i.e., mvn javadoc:javadoc. The standard goals can be found here: https://maven.apache.org/plugins/maven-javadoc-plugin/plugin-info.html .
I am trying to set the build name of a Jenkins build only on a successful build. Any failure, whether in building or testing, should use the 'default' (build number) instead.
I can't find any mention of this in the documentation or online. Is this possible?
It is pretty simple to do with Groovy Postbuild: https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin
You have some nice examples there too. So just check result and then set the:
manager.build.result
As they do in Example 3
In the post build operation you can run a "set of scripts" - there you can select any way to do so, set a description, run system groovy or groovy script to change the name or any other method of your choosing - you can add many build steps to help you do so. wrap it around a conditional statement and run it only when build is successful.
Good luck!
I am using Jenkins as our build tool. I don't want System.out.println to be there in the code. Is there a way by which we can add a hook which will check this. And if any .java file is detected with System.out.println then fail the build.
You can use a static code analysis tool. For example PMD (https://pmd.github.io/pmd-5.3.3/index.html) .
You can specify a rule that checks for calls to System.out.println.
How to write a rule: https://pmd.github.io/pmd-5.3.3/customizing/howtowritearule.html
You can analyze your code with PMD over Jenkins via the PMD plugin: https://wiki.jenkins-ci.org/display/JENKINS/PMD+Plugin
There are some good tutorials for using PMD with Jenkins. A good one is this: https://www.youtube.com/watch?v=aRgYd-SLyrs
If you want to "Jenkins-ize" this, set up Jenkins to run with Sonar, and add a rule in Sonar that fails if System.out.println is found.
Advantages:
- you can run nightly sonar builds
- you can add more than that one rule (and you should ;))
- you will check code on the whole branch, not just yours.
I'm trying to pass a -lib argument to ant as part of an automated build using Hudson but can't see a way to do this. I could add the relevant libraries to the ant/lib folder but that would then mean the same version of the library necessarily being shared by all builds on that machine.
Any help much appreciated.
In your Hudson job configuration you can specify ant arguments such as -lib in the Targets field. See the help message that opens when you click the ? next to the Targets field.