I'm using Travic CI as a tool for coutinuous integration on a java maven project and my .travis.yml file is configured this way :
language: java
sudo: false
script: mvn clean verify
But when I execute, I get this error :
The travis ci build could not complete due to an error
The command "eval mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V" failed.
Anyone have an idea on how to fix this problem ?
Thanks
It seems you are using maven-compiler-plugin 1.8 in you pom.xml. The supported version of travis-ci server is 7, so change it to 1.7
link
Related
In my gitlab-ci.yml configuration I have the following snippet:
before_script:
- java -jar /home/gitlab-runner/tools/ciVersioner-1.0.jar $MAJOR $MINOR $CI_COMMIT_SHORT_SHA
script:
- mvn --projects employees --also-make clean package -DskipTests
after_script:
- echo $HOSTNAME $WHOAMI
artifacts:
paths:
- employees/target/*.jar
expire_in: 30 days
It does not work but for a different reason (since java versions are incompatible).
Here's the output:
The solution was to install a newer java 11.
I did so and changed the configuration correspondingly:
before_script:
- /opt/java11/jdk-11/bin/java -jar /home/gitlab-runner/tools/ciVersioner-1.0.jar $MAJOR $MINOR $CI_COMMIT_SHORT_SHA
script:
- mvn --projects employees --also-make clean package -DskipTests
after_script:
- echo $HOSTNAME $WHOAMI
artifacts:
paths:
- employees/target/*.jar
expire_in: 30 days
However, with this configuration nothing works at all:
But if I execute this command in VM environment directly, it works as expected.
Is there a limitation on using full qualified path in the yml file or maybe it has to do with something else?
Before you updated java the job fail at the java command, so it didn't try to execute mvn.
However, when the first problem is solved, you get a new issue and now with mvn command.
I guess the runner cannot recognize mvn because maven is not installed.
You could try adding the following to the before_script section:
- apt-get update && apt-get install maven
This is will depend on the linux distribution, use yum instead if the runner is on redhat or centos
I am trying to build, run tests and publish JaCoCo code coverage reports using Azure Devops pipelines. I followed the documentation of the task provided in link here
The final task which i am running is something like this:
- task: Maven#3
displayName: Build Project
inputs:
mavenPomFile: 'pom.xml'
goals: 'clean package'
options: '-s settings.xml'
publishJUnitResults: true,
testResultsFiles: '**/surefire-reports/TEST-*.xml'
codeCoverageToolOption: 'jaCoCo'
....
This results tasks runs fails at the verify step. Below is the maven commands those get run:
/usr/share/apache-maven-3.6.3/bin/mvn -version
/usr/share/apache-maven-3.6.3/bin/mvn -f /home/vsts/work/1/s/pom.xml help:effective-pom -s settings.xml
/usr/share/apache-maven-3.6.3/bin/mvn -f /home/vsts/work/1/s/pom.xml -s /home/vsts/work/_temp/settings.xml clean package and finally
/usr/share/apache-maven-3.6.3/bin/mvn -f /home/vsts/work/1/s/pom.xml verify - FAILS
As you can see for step 2 and step 3 both have -s settings.xml in the command, but in case of step 4 (which is initiated by the JaCoCo part of the task), the option (-s settings.xml) is not passed because of which certain dependencies are not getting downloaded and the build is failing.
Can anyone provide me some insights as to how to propagate the maven args to the JaCoCo coverage mvn verify command. Thanks in advance for your help.
I set up Jenkins with two Execute shell builds Java -version and mvn -version. Console output shows the below error.
My Global tool config is:
Terminal output for Java -version and mvn version, Java_Home and Maven_Home is:
This is my .bash_profile:
So Java and Maven is installed correctly. Java home and Maven home commands returns null but Jenkins build passed for Java -version, fails only for mvn -version. What am I doing wrong here?
I've been trying to set up GitLab-CI to build Maven Java projects in Raspbian, but whenever It tries to run the build script it fails because it can't find Maven. I used this guide to install the runner.
Build trace:
Running with gitlab-ci-multi-runner 1.10.4 (b32125f)
WARNING: image is not supported by selected executor and shell
Using Shell executor...
Running on raspberrypi...
Cloning repository...
Cloning into '/home/gitlab-runner/builds/f09314a8/0/RBian/TestProject'...
Checking out 54d2e140 as master...
Skipping Git submodules setup
$ mvn clean package
bash: line 22: mvn: command not found
ERROR: Build failed: exit status 1
.gitlab-ci.yml
image: maven:3-jdk-8
build:
script: "mvn clean package"
artifacts:
name: "TestProject"
paths:
- "target/*.jar"
Does anyone know what causes this?
EDIT: Modifying /etc/default to add $MAVEN_HOME/bin to $PATH did the trick.
Try adding MAVEN_HOME path into config.toml environment field.
environment = ["MAVEN_HOME=/path/to/maven"]
I have a JHipster project I want to build through Travis CI and then deploy to Heroku. However, even if Travis CI passes the build, it commits the whole code to Heroku and then Heroku tries to build the whole project again, defeating the purpose of having Travis CI in the middle.
Is there a way to build my project with Travis CI and then just deploy the build WAR to Heroku?
Given the fact that JHipster uses Spring Boot, I would only need the WAR to run the application.
Here is my .travis.yml files:
language:
- java
jdk:
- oraclejdk8
sudo: false
env:
- MAVEN_CUSTOM_OPTS="-Pprod,heroku -DskipTests"
before_install:
- npm install -g npm
- rm -fr /home/travis/.npm/
- npm cache clean -g
- npm install grunt-cli -g
- npm install
install:
- mvn package -Pprod -DskipTests
script: true
notifications:
webhooks:
on_success: change
on_failure: always
on_start: false
deploy:
provider: heroku
api_key:
secure: [key]
skip_cleanup: true
Also, if there is another way to deploy a Spring Boot application through this process, it would be great.
Thank you.
You can install the heroku-deploy plugin on Travis CI and deploy the same way you deploy to Heroku locally.
In fact, this is what the heroku-deploy plugin does to test itself, so you can use it as an example. The setup script downloads the Ubuntu installer for the toolbelt from: https://toolbelt.heroku.com/install-ubuntu.sh
Then you'll only need to install the plugin with this command in your setup script:
heroku plugins:install https://github.com/heroku/heroku-deploy
And set your API key as a secure variable in the .travis.yml