I have a github repository in the organization and the Travis file has been changed to:
language: java
jdk: oraclejdk8
mvn installation
mvn test
however, it looked different and contained a ant test command that was removed.
Recently, when I try to restart a job, do the following again:
Ant test 0,23 USD Buildfile: build.xml does not exist! The
construction was unsuccessful The "ant test" command ended at 1.
and in the config view there is no current travis file with github.
What's the problem? why Travis doesnt see my changes in github files?
Related
I have a test project that is built with Maven (Java). I can either execute the test from IntelliJ manually or from the command line by writing mvn test.
I put the project on CircleCI and it generated a yml file. And it was able to execute the tests on pipelines as well without any issue at first
Then I made something stupid. Initially tests were in this root: src/main/java/api/test. But I decided to move the test class to this root: src/test/java/api.
I did this change because src/test/java was the actual test folder created automatically when you create a Maven project. (The other test folder was created by me manually so I thought this was not the best practice and therefore decided to move the test class to src/test/java. Basically what I did is, I created a package named api under src/test/java and moved the test class to this package. After that I deleted src/main/java/api/test as it is empty now.
After this change, I didn't observe any issue. I could still run the tests from IntelliJ or from the command line by mvn test command. But after I commit my changes, I just checked the pipelines and saw this:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.793
My project is still built and tested on CircleCI but it obviously does not execute the test class. I dont know why it is happening. I checked the yml file and there is nothing related with paths and it was working before. Here is my yml file:
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
jobs:
# Below is the definition of your job to build and test your app, you can rename and customize it as you want.
build-and-test:
# These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
# You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# Be sure to update the Docker image tag below to openjdk version of your application.
# A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/openjdk
docker:
- image: cimg/openjdk:11.0
steps:
# Checkout the code as the first step.
- checkout
# Use mvn clean and package as the standard maven build phase
- run:
name: Build
command: mvn -B -DskipTests clean package
# Then run your tests!
- run:
name: Test
command: mvn test
workflows:
# Below is the definition of your workflow.
# Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
# CircleCI will run this workflow on every commit.
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
sample:
jobs:
- build-and-test
As I said the same yml file was working fine before I moved the test class. Now it probably can not locate my test file. What could be the problem here and how can I solve this? Any help is appreciated.
I'm trying to run the basic maven java action listed here on my repo here: https://github.com/dhowe/rita2/
The mvn -B package --file pom.xml cmd runs correctly in my local repo, but the tests fails in the github action with the following error (full log here):
Exception: Cannot load dictionary at rita_dict.js /home/runner/work/rita2/rita2
So its clear that the dictionary resource is not being found when run via the github action. But why would the file (src/main/java/rita_dict.js) be found by maven locally, but not when run in the action ?
Switched to specifying the resource in /src/main/resources as suggested by P3trur0 (not sure why it wasn't working when specified as a resource in maven) after which builds work as expected
I'm configuring my sonarqube to run on my project, following the instructions given to run from the cloud I have my file like this:
sonar.projectKey=yisera_aaswtest
sonar.projectName=aaswtest
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.language=js
sonar.profile=node
sonar.exclusions=node_modules, migrations, models_old, seeders, .gitignore
I downloaded sonarqube CLI, copied the bin file to %path% on windows but for some reason, after running the test, I get the following error:
Property "sonar.cfamily.build-wrapper-output" was not specified
As you can see, my project is in javascript(nodejs specifically) and not C++, and even then, for some reason it's scanning my node_modules folder while I explicitly state in my properties file to exclude scanning there.
Any ideas what I might be doing wrong? Here is the command I run:
sonar-scanner.bat -Dsonar.projectKey=yisera_aaswtest -Dsonar.organization=yisera-bitbucket -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=cc10c0f538a6b50c876c2c53ed479eadd3e60988
This question is very specific to Bluemix DevOps.
I have a Java backend application that has a sizeable JavaScript front-end. So I created a GRUNT task to do the needed: uglify, minify, CDNify etc. My current setup is to have the Bluemix build just running mvn -B package and the Grunt task beforehand as a script on my local machine:
#!/bin/bash
grunt build
git add --all
git commit
git push origin master
But that precludes any edit using the online editor. So I'd like to have both task to run by the pipeline. I see 3 options:
Run both tasks in one build block triggered by git push as separate tasks
Run them in one build script triggered by git push
Run 2 pipeline steps, the first triggered by git push, the second by the completion of the first
something else
I haven't tried it yet (shame on me), just wanted to ask if someone did that before (If yes - cool, if no I will post my findings later on)
Solved it. This is what I tried:
modify the script in build and prefix with npm install npm or mvn (depends on what I selected) wasn't found)
add 2 jobs to one build stage, one grunt one maven (the deploy task would not find the war file)
Use 2 pipeline stages (see picture below) : Horray --- that worked.
None of the build steps required setting a directory, which is a little trap, since mvn sets target as default directory, so remove this. The script for Bower/Grunt is this:
#!/bin/bash
npm install
grunt build
the script for the maven task:
#!/bin/bash
mvn -B package
works like a charm (just be careful not to add npm modules you don't actually need, it slows the build quite a bit)
I have created a maven project in STS.I completed the development and testing code for my project.If now I want to run or build this project, then I have to do the following
Right click on the project-->Run as-->Run on Server (or)
Right click on the project-->Run as-->Maven Build
If I want to run the test code then
Right click on the class file-->Run as-->Run JUnit
But I want to create a text file I mean script file to run all these commands when I run this script file from the cmd prompt. I have found out on a web site that I should create a PowerShell file, So I don't cognize how to compose a script file like this, is there any example file for it ?
Please, anybody can help me
You can just run mvn clean install on your project root folder (i.e. where your pom.xml file is) in cmd prompt. This command will trigger your project default build lifecycle covering a number of build phases including:
validate
compile
test
package
integration-test
integration
verify
install
During these build phases, Maven will validate and compile your project, run tests (if any) against your codes, package the resultant binaries into say, a JAR file, run integration tests (if any) against your JAR, verify it, and then install the verified package to your local .m2 repository.
If you really want a script, then just add mvn clean install to your batch file.