I have an RCP application which I build in Jenkins using "mvn clean verify" to run Maven/Tycho. When the target platform of my application contains a p2 repository site that is not available anymore, Tycho prints a warning but still uses it's local cache.
[WARNING] Failed to access p2 repository http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo, use local cache. Neither http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.jar nor http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.xml found.
It took my quite some time to notice this problem because the Jenkins build succeeds without any issues and I am not going to read all console output...
I would like to get notified of this issue so I can take measures when a repository is moved or deleted. Tycho should still use it's cache under normal circumstances.
Can I solve this using Jenkins or can I instruct Tycho to fail fast (drawback: also fails on temporary outage)?
To partly answer my question the best solution is probably to set up a local p2 mirror, but I think this requires a lot more work.
You can mark a Jenkins build unstable or failed based on it's output by using the Jenkins Text finder plugin.
Manage Jenkins plugins and install the text finder plugin from the
Available plugins.
Edit the project to add a post-build action "Jenkins Text Finder".
Check 'Also search the console output', set the Regular expression to
'Failed to access p2 repository' and check 'Unstable if found'.
We have something very strange on jenkins.
If we commit some codes, Jenkins will notice that the changes are there and the build will be triggered. But it builds with OLDER CODES, not the new ones!
How could it happen? Did we configure something wrong?
As source control we use git. Jenkins knows the repository and if there is something changed in the repository, jenkins starts to build.
Our build configuration is like this:
Build:
Maven: 3.04
Stamm-Pom: pom.xml
Goals and Options: -e -s ./settings.xml -Pdev clean wildfly:deploy
And we don't have any pre-build steps.
Problem solved. We commited caches into the source control repository. And we only use wildfly:deploy to build, then the caches are used. We just need to delete the caches and add lines in ".gitignore" to ignore the caches, so that the caches are not commited any more.
I have the following setup:
I use the workspace cleanup plugin in Jenkins to clean my workspace before each build. During my build-process I also trigger a vagrant up to setup a VM for phpunit tests:
$ vagrant up
$ ./runtest.sh
$ vagrant suspend
Now when I re-build the project, the VM gets build as a new one instead of just resuming the previous one. I guess this is because of the cleanup plugin removing the .vagrant-directory, therefore making Vagrant think it should build a new machine instead of just resuming the previous one.
Now I have configured the plugin to exclude the following patterns and I have the 'Apply pattern also on directories'-checkbox also checked:
**/*.vagrant
.vagrant
.vagrant/
./.vagrant
./.vagrant/
But still the .vagrant-directory gets deleted from the workspace on each new build, spawning a brand new VM each time...
Does anyone know how I can exclude the .vagrant-directory from the workspace cleanup plugin?
Turned out I was having a logical error. What I did as first task was checkout and hard-reset a specific branch to the master. So it was this step that actually deleted the .vagrant-directory after the cleanup-task did what it was expected to do.
According to the plugin documentation, it provides include and exclude patterns. You need to change the dropdown to exclude pattern (marked with arrow #2 in the diagram on plugin page), and type .vagrant in the pattern. Should probably also click "apply to directories"
I have a project that is building fine on my laptop. Today I started to set up the build for this on our Bamboo server. Everything is checked in. Both my laptop and the build server are using Maven 3.0.4.
I have a top-level aggregator pom that specifies several modules, but this pom is not the parent of any module. I do use parent poms, but those parents are in peer submodules of the submodules that depend on them, and I have blank "relativePath" elements in all poms.
In the Bamboo build of the top-level aggregator POM, I see several errors like this:
[ERROR] The project com.example.cde:java-project-parent:1.0.1 (/volatile/bamboo/bamboo3.4.3_data/xml-data/build-dir/FOO-BUILD-JOB1/java-project-parent/pom.xml) has 1 error
18-Dec-2012 16:40:21 [ERROR] Non-resolvable parent POM: Failure to find com.example.cde:project-parent:pom:1.0.0 in http://hostname.net:8081/nexus/content/groups/stuff was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced and 'parent.relativePath' points at no local POM # line 6, column 11 -> [Help 2]
The "java-project-parent" is one of the poms in the parent hierarchy.
What I've discovered is that running "mvn install" in the top-level aggregator pom isn't actually installing the artifacts in the submodules. When I looked in the local repo, the only thing in each directory in the local repo was a file like "...pom.lastUpdated". The actual POM wasn't there.
When I had the admin manually run "mvn install" in the first submodule, that actually installed the POM into the local repo. I have a feeling if he manually installs the other two parent poms, the build of the project that depends on all three of them will build fine.
I must be misunderstanding an important detail of how a build with submodules works. What am I missing?
run maven clean install with Force update option as below:
mvn clean install -U
Your hierarchy is probably broken. You can test that by building it in your local machine after wiping the local repository. Most likely you will find the same failures as on the build machine.
To fix it I would suggest remove all the relative path elements and adjust the structure so a build will work fine. Ideally you even break the pure parent projects out into separate projects and release them into your repository manager so that any other builds get them from there..
Try doing a mvn -U install to force a mvn trip to your nexus repo for updated aritfacts
Also run mvn with the -e switch to see detailed error messages
I've installed the Gradle plugin for Jenkins. When I try to build the project I get the following error:
[workspace] $ gradle clean -b build/build.gradle
FATAL: command execution failed
java.io.IOException: Cannot run program "gradle" (in directory "/Users/Shared/Jenkins/Home/jobs/test/workspace"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:707)
at hudson.Launcher$ProcStarter.start(Launcher.java:338)
at hudson.Launcher$ProcStarter.join(Launcher.java:345)
at hudson.plugins.gradle.Gradle.performTask(Gradle.java:201)
at hudson.plugins.gradle.Gradle.perform(Gradle.java:97)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:695)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)
at hudson.model.Run.run(Run.java:1404)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 16 more
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
Running the task $ gradle clean -b build/build.gradle from the command line works as expected.
I had the same issue and found that the problem for me was the gradle version in the project configuration. It was set to Default and when I set it to the gradle version I was pointing to in the plugin configuration in the Manage Jenkins > Configuration Options, It found gradle and worked properly.
This is a difficult issue to debug and I hope this saves someone else some time.
Solution Mastering_the_Object pointed out worked form me too, just to clarify steps there:
just installing Gradle plugin in Jenkins is not enough, you must also go to:
Jenkins->Manage Jenkins->Configure Jenkins->Configure system.
Under "Gradle Installations" type in name (it appears as version in project configuration), check "Install automatically" and select version. Then you can select that "Gradle version" in project configuration.
I was getting this error using the Gradle wrapper, was able to fix my broken build as follows:
Go to Manage Jenkins -> Global Tool Configuration -> Gradle -> Add Gradle, give it a name
Go to Jenkins -> (your job) -> Configure -> Build, choose "Invoke Gradle" and change the Gradle version from (Default) to the named version
When running Gradle on a CI machine such as Jenkins, it's most convenient to use the Gradle Wrapper.
On your development machine, stand in your root project directory and run
gradle wrapper
Then, check in the resulting files into your source control system. After that, you don't have to install anything on your Jenkins server if you need to change Gradle versions. Just configure your Jenkins job like this:
Quoting from the Gradle User Guide:
By distributing the wrapper with your project, anyone can work with it
without needing to install Gradle beforehand. Even better, users of
the build are guaranteed to use the version of Gradle that the build
was designed to work with. Of course, this is also great for
continuous integration servers (i.e. servers that regularly build your
project) as it requires no configuration on the server.
The jenkins can not find the gradle executable. I have never made gradle wrapper to work. Please follow the following steps:
Download gradle ( http://gradle.org/downloads),
unpack it to, e.g., /usr/local/lib/gradle ,
open /etc/profile and add the following two lines:
export GRADLE_HOME=/usr/local/lib/gradle
export PATH=$PATH:$GRADLE_HOME/bin
It works for my jenkins installation.
ps. I answer this old question, because it is a common issue when setting up gradle with jenkins. I have spent some time trying to make the gradle wrapper work without success before.
Used both #Skarab & a number of other solutions here to get it to work.
Download gradle ( http://gradle.org/downloads),
unpack it to, e.g., /usr/local/lib/gradle ,
open /etc/profile and add the following two lines:
export GRADLE_HOME=/usr/local/lib/gradle
export PATH=$PATH:$GRADLE_HOME/bin
Then under Manage Jenkins > Configure system > Gradle, defined GRADLE_HOME and gave that gradle installation a name
Then, {this could be a bug} for the project, change gradle version from Default to the one I defined above
As others have noted, this is because Jenkins can't find the gradle executable.
None of the published solutions worked for me, but I was able to fix the problem by adding the gradle bin dir to the path set in the .bashrc for the build account on the build slave. Modifying the .profile failed, and setting PATH in the jenkins node configuration also failed.
Some posts will suggest setting the gradle path in the tools menu, but no gradle entry was available there either (perhaps due to regressions / design changes in the gradle plugin?).
In any case, the best test I found (short of running the build again and watching for failure) was to run env over ssh:
ssh <host> env
and check the PATH variable defined that way; if gradle isn't in that path, you probably won't be able to run it from jenkins.