I've setup two Java projects with the same .travis.yml file.
One works fine, one fails, because it appears that they're using different workers. One fails with
Fails: https://travis-ci.org/prism/Bedrock/jobs/110693590
"Sorry, but JDK 'openjdk8' is not known."
Works: https://travis-ci.org/prism/Prism/jobs/110620073
Another, using oraclejdk8 fails with checkstyle errors, yet checkstyle when run locally has no problems.
I can't find any information as to why the workers would be different, and openjdk8 is unknown in one vm, but not a problem in another.
Our config:
dist: trusty
install: true
language: java
jdk:
- oraclejdk8
script: gradle build
Related
I'd like Travis CI to build and deploy the following artefacts to PyPI whenever a new commit hits the master branch:
Python 2 wheel
Python 3 wheel
Source
To make this happen, I've added the following to .travis.yml:
language: python
python:
- '2.7'
- '3.5'
- '3.6'
deploy:
on:
branch: master
provider: pypi
distribution: bdist_wheel sdist
For normal build/test, the configuration works great. However, it introduces a race condition when deploying to PyPI:
Uploading distributions to https://upload.pypi.org/legacy/
Uploading PyOTA-2.0.0b1.tar.gz
HTTPError: 400 Client Error: File already exists. for url: https://upload.pypi.org/legacy/
What changes should I make to .travis.yml to get Travis CI to deploy the correct artefacts to PyPI?
I ran into this problem today and eventually found this under-documented gem:
deploy:
provider: pypi
skip_existing: true
...
I use skip_existing: true on a project to get source and wheels published once even though I test across a couple of different configurations and python versions. Handy. More details in this resolved github issue. I also submitted a documentation diff.
Some days I think outside the box; other days it's just a really big box.
Previously, this project needed separate wheels for Python 2 and Python 3, so I needed Travis CI to build wheels using different versions of Python.
But recently I got the project to build universal wheels correctly, so now Travis can build all of the deployment artefacts using any one version of Python.
I modified .travis.yml accordingly, and everything is working great:
deploy:
on:
branch: master
python: '3.6'
According to:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206842605-Running-IntelliJ-code-coverage-headless-on-Jenkins-
It is possible to use intellij code-coverage runner in a headless environment - i.e. Jenkins.
This is nice since IntelliJ reports much more accurate coverage results on new groovy code than e.g. Cobertura. And I can also collect information from Grails tests - unit and integration. However, I have no idea on how to set it up - gradle, maven, custom build-script or whatever - on Jenkins.
When IntelliJ runs Grails tests it fires the following command:
C:\Program Files\Java\jdk1.7.0_79\bin\java
-XX:+TieredCompilation
-XX:TieredStopAtLevel=1
-XX:CICompilerCount=3
-Dgrails.full.stacktrace=true
-Djline.WindowsTerminal.directConsole=false
-Dgrails.build.listeners=org.jetbrains.groovy.grails.rt.GrailsIdeaTestListener
-Didea.launcher.port=7533
"-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3\bin" -classpath C:\Users\xxx\AppData\Local\Temp\classpath.jar
-Dfile.encoding=UTF-8 com.intellij.rt.execution.application.AppMain org.grails.cli.GrailsCli test-app -echoOut
Which indicates that IntelliJ should be installed to run it headless. Is it possible to execute the above command in a headless env?
I have tried unpacking intellij and by executing the following (slightly modified for linux) command:
java
-XX:+TieredCompilation
-XX:TieredStopAtLevel=1
-XX:CICompilerCount=3
-Dgrails.full.stacktrace=true
-Djline.WindowsTerminal.directConsole=false -Dgrails.build.listeners=org.jetbrains.groovy.grails.rt.GrailsIdeaTestListen r
-Didea.launcher.port=7533
-Didea.launcher.bin.path=/home/jenkins/idea/bin -classpath /tmp/classpath.jar
-Dfile.encoding=UTF-8 org.grails.cli.GrailsCli test-app -echoOut
it fails with:
Error: Could not find or load main class com.intellij.rt.execution.application.AppMain even with idea_rt.jar added to the command with "cp" flag.
Is this a goose chase, or could it be done?
Did you check classpath.jar on Windows? This file is automatically generated and links lots of jars via Manifest to avoid OS limitation for the maximum command line length. Your /tmp/classpath.jar either doesn't exist or doesn't link the dependencies correctly.
Final classpath would include several IDE jars from the lib directory, project classes from the output directory and dependencies, plugin jars, etc. In other words, everything required to run the app would be linked from the generated classpath.jar file.
I'm converting an existing Maven based project containing a Grails 2.4.2 application to Gradle 2.6 and Grails 3.0.4. It's a mixed environment with Java, Groovy, and Grails used in several sub-projects. I've converted all the pom.xml files into build.gradle files, starting off with ./gradlew init, and then hand editing as needed. Before converting the Grails project's grails-app/conf/BuildConfig.groovy to the build.gradle equivalent, everything built fine with Gradle 2.6. After I converted the Grails project's BuildConfig.groovy file to build.gradle, I'm getting the following error when trying to run ./gradlew build:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':foo:runtime'.
> Could not find json-lib-jdk15.jar (net.sf.json-lib:json-lib:2.4).
Searched in the following locations:
file:/Users/xyz/.m2/repository/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The json-lib-2.4.jar file does exist in the local M2 cache shown above, but it doesn't have the -jdk15 part in it. There's no explicit dependency to any json-lib jar file in the build.gradle file for the Grails project. A parallel project does have an explicit dependency on this library, but that project builds fine. I've tried to explicitly add the dependency to the build.gradle file in the Grails project both with and without "classifier: 'jdk15'" to the dependency declaration. When I ran ./gradlew dependencies, I noticed that an older version (2.3) of the json-lib jar file showed up in the list as an implied dependency for some Apache HttpComponent stuff. I then tried both versions of this in the allProjects section of the top level build.gradle:
configurations {
all*.exclude module: 'json-lib'
}
as well as:
configurations {
all*.exclude module: 'json-lib', classifier: 'jdk15'
}
Neither variant makes any difference. I'm really stuck on this and would appreciate any tips on how to move forward. In case it makes a difference, I'm running this on a Mac with MacOS 10.10.5, the JDK version is 1.8.0_25-b17. Thanks.
dependencies {
//compile group: 'net.sf.json-lib', name: 'json-lib', version: '2.4'
compile "net.sf.json-lib:json-lib:2.4:jdk15"
}
Travis has an easy way to test a project against different PHP versions.
Now I want to run tests for plugins. For that I wrote a script that is called in the install phase of .travis.yml which checks out the main project and moves my plugin source into the correct directory. Then the tests are run. So far so good.
Now I would like to provide two of these scripts. One that checks out the main project's current master branch and one that checks out the latest stable version. The plugin should be tested against both checkouts in completely separate test runs just like it is ran against different PHP versions.
Is there a simple way to configure this in .travis.yml?
You need to use env option:
env:
- TEST_NAME=my_test_1
- TEST_NAME=my_test_2
- TEST_NAME=my_test_3
script:
- ./test-run.sh --test-name=${TEST_NAME}
documentation (Set environment variables section)
example
Problem
I have just installed the Sonar Jenkins plugin. I went into my configured job (a free style job) that produces a WAR file artifact through an ANT build and did as follows:
Check the Sonar checkbox. (No problems here)
Configure the install dir of sonar (No problems here)
Checked the checkbox that states: "Check if this project is NOT built with maven 2" (I am confused here)
I have checked that box because I am not using maven for build, I am using ANT but it still asked me for required properties that resemble a lot MVN such as: Organization id, project id, project name, project version, source directories... etc..
So I have filled those as well. When I click the play button "Build Now" the build seems to be running fine as it always had prior to sonar installation but it fails at the very end because its trying to execute MAVEN.
See as follows:
$ mvn -f /root/.jenkins/jobs/HRDA/workspace/pom.xml -e -B sonar:sonar
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn" (in directory "/root/.jenkins/jobs/HRDA/workspace"): java.io.IOException: error=2, No such file or directory
Questions
Why is Sonar trying to execute Maven if I have checked the box that said check this box if you do NOT use Maven 2?
Can I make use of this Sonar plugin if my apps are built with ANT, GANT, GRADLE?
Do I have to reconvert my apps to use MVN builds?
Thanks,
- Dario
Like Oers suggested on my question comments if you are using ANT as a build script in your CI server (Jenkins in my case) you will have to use the SONAR-ANT-TASK to generate Sonar reports, do as follows:
Download MySQL or any other Sonar supported RDBMS such as Postgres, Oracle, etc..'
Download and Install sonar server.
go to (sonar installation folder)/extras/database/mysql and run the create_database.sql script.
I had to run an extra sql statement in my case using mysql, you can see here Unable to access Sonar MySQL database Caused by: java.sql.SQLException: Access denied for user 'sonar'#'glassfishdev.ccs.local' (using password: YES)
Start Sonar by typing ./sonar.sh start
Add the sonar ant task to your build script. You can follow this template http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task+1.0
DO NOT check the sonar check box in your Configure screen if you have the Hudson Sonar plugin for installed, as this plugin only works with Maven projects.
Click the "Build Now" button. If everything above has been done correctly you should be able to see the reports at http://ipaddressofmachinesonarisinstalled:9000/
Hope this helps,
-Dario