I'm trying to build a kotlin library using gradle (wrapped) and gitlab-ci. If i execute commands on my machine everything works fine but gitlab-ci test job doesnt not end and is pending on Task :test.
I'm using basic gitlab-ci inspired by this example.
image: gradle:5.6.2-jdk8
stages:
- build
- test
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build-latest:
stage: build
script:
- ./gradlew assemble
only:
- master
- tags
test:
stage: test
script:
- ./gradlew check
and that's gitlab-ci ( 12.2.5 ) output
Running with gitlab-runner 12.2.0 (a987417a)
on autoscale-runner eaccdfe9
Using Docker executor with image gradle:5.6.2-jdk8 ...
Pulling docker image gradle:5.6.2-jdk8 ...
Using docker image sha256:5eacc675d8626e3db6a6c4030fc817113f536f565ecd23b7f5aec7e5e5bfcc53 for gradle:5.6.2-jdk8 ...
Running on runner-eaccdfe9-project-769-concurrent-0 via runner-eaccdfe9-autoscale-1570629641-a91eb9db...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/platform/libraries/kafka2rest/.git/
Checking out 69a3b20e as master...
Removing .gradle/
Removing build/
Skipping Git submodules setup
Checking cache for default-1...
Downloading cache.zip from http://10.164.0.3:9000/runner/runner/eaccdfe9/project/769/default-1
Successfully extracted cache
$ export GRADLE_USER_HOME=`pwd`/.gradle
$ ./gradlew -v
Welcome to Gradle 5.6.2!
Here are the highlights of this release:
- Incremental Groovy compilation
- Groovy compile avoidance
- Test fixtures for Java projects
- Manage plugin versions via settings script
For more details see https://docs.gradle.org/5.6.2/release-notes.html
------------------------------------------------------------
Gradle 5.6.2
------------------------------------------------------------
Build time: 2019-09-05 16:13:54 UTC
Revision: 55a5e53d855db8fc7b0e494412fc624051a8e781
Kotlin: 1.3.41
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 1.8.0_222 (AdoptOpenJDK 25.222-b10)
OS: Linux 4.15.0-1044-gcp amd64
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)
$ ./gradlew check
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileKotlin
> Task :compileJava NO-SOURCE
> Task :processResources
> Task :classes
> Task :compileTestKotlin
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :test
What's wrong with this? Is there any standard or template for building kotlin with gradle and gitlab-ci?
Edit
I've found the pending test suite. It contains 3 test, any of them create new instance of controller that has the same start() method. The start() method launch a new thread. If just one test runs it works with successful gitlab-ci termination, if two or more test run it doesn't and it remains in pending state. In tests I use semaphores.
Tests still work locally.
Related
I created a job Maven Project in Jenkins for the purpose to Compile and execute all my automatic tests, but when i build the job i got this error :
i got the same message error for all the scenarios
should i create a pipeline in place of project maven ?
i recupare my project with the link ssh GitLab and im working behind a proxy
Thnaks(y)
Here is a docker-compose file that will open 7 instances of FF and 1 instance on chrome. I use it with azure pipeline but you can integrate it with jenkins. You'll will have to add a jenkins task that runs docker-compose
To try on command line , just install docker desktop ( i use it with mac) and run below command
docker-compose -f /path/of/file up
version: "3"
services:
selenium-hub:
image: selenium/hub:3.141.59-20210607
container_name: selenium-hub
ports:
- "65299:4444"
chrome:
image: selenium/node-chrome:3.141.59-20210607
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
firefox:
image: selenium/node-firefox:3.141.59-20210607
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
deploy:
mode: replicated
replicas: 7
For using docker-compose with azure pipeline , I am using the below.
Make sure you have dockerRegistryEndpoint setup (in below ex: Dockerhub) . I use this to run my cucumber tests and integrate third party cucumber report (PublishCucumberReport#1)in pipeline
trigger:
- master
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build and Push image
jobs:
- job: Build
displayName: Build and Push
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DockerCompose#0
displayName: open browser instances
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: Dockerhub
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a Docker Compose command'
dockerComposeCommand: 'up -d'
detached: true
- task: Maven#3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/target/cucumber.html'
goals: 'clean verify -P acceptanceTests -e -X'
- task: PublishPipelineArtifact#1
displayName: Publish cucumber report
inputs:
pathToPublish: $(System.DefaultWorkingDirectory)/s/target/cucumber-report/
artifactName: 'cucumber.html'
- task: PublishCucumberReport#1
inputs:
jsonDir: ./target/cucumber-report/
outputPath: ./target/
For documentation , refer - https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/docker-compose?view=azure-devops
I am using Netbeans 8.2 and Tomcat 9. I just create a new project and trying to run but every time it shows this error and for existing projects also it is running another PC smoothly.
Can you please suggest something for the solution -
ant -f "C:\\Users\\UserName\\Documents\\NetBeansProjects\\Test" -Dnb.internal.action.name=run -Ddirectory.deployment.supported=true -DforceRedeploy=false -Dnb.wait.for.caches=true "-Dbrowser.context=C:\\Users\\Rifat Tanjir\\Documents\\NetBeansProjects\\Test" run
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
In-place deployment at C:\Users\UserName\Documents\NetBeansProjects\Test\build\web
deploy?config=file%3A%2FC%3A%2FUsers%2FRIFATT%7E1%2FAppData%2FLocal%2FTemp%2Fcontext4316755968276891464.xml&path=/Test
Server returned HTTP response code: 500 for URL: http://localhost:80/manager/text/deploy?config=file%3A%2FC%3A%2FUsers%2FRIFATT%7E1%2FAppData%2FLocal%2FTemp%2Fcontext4316755968276891464.xml&path=/Test
C:\Users\UserName\Documents\NetBeansProjects\Test\nbproject\build-impl.xml:1045: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 14 seconds)
I am trying to use Gradle on my Windows machine. The command I want to be able to use is:
gradle init --type java-application
But here is the error I get when I run this command on Powershell (or cmd):
> Task :init FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':init'.
> The requested build type 'java-application' is not supported. Supported types:
- 'basic'
- 'cpp-application'
- 'cpp-library'
- 'groovy-appl²cat²on'
- 'groovy-gradle-plugin'
- 'groovy-l²brary'
- 'java-appl²cat²on'
- 'java-gradle-plugin'
- 'java-l²brary'
- 'kotlin-appl²cat²on'
- 'kotlin-gradle-plugin'
- 'kotlin-l²brary'
- 'pom'
- 'scala-appl²cat²on'
- 'scala-l²brary'
- 'swift-application'
- 'swift-library'
As seen in the output, there is probably an encoding issue here. Because
java-appl²cat²on
is displayed as a possible type.
I used versions 6.9 and 7.0.2 and the results are the same. My system language is Turkish but I also use Git, Maven etc. without any issues.
Here is the output of gradle --version in case it is useful:
------------------------------------------------------------
Gradle 6.9
------------------------------------------------------------
Build time: 2021-05-07 07:28:53 UTC
Revision: afe2e24ababc7b0213ccffff44970aa18035fc0e
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_231 (Oracle Corporation 25.231-b11)
OS: Windows 10 10.0 amd64
Update: Issue #17383 has been fixed and is targeted for Gradle 7.2.
You may hit a bug in Gradle. I was able to reproduce the issue by forcing tr-TR locale in environment variable JAVA_TOOL_OPTIONS. I filed a bug in the Gradle issue tracker to have this checked: Build init plugin is locale sensitive.
As a workaround, you could force English locale for project initialization, in Powershell:
PS> $env:JAVA_TOOL_OPTIONS="-Duser.language=en -Duser.country=US"
PS> gradle.bat init --type java-application
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en -Duser.country=US
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2]
When I tried to use java to connect my local server in Intellij, I got this error. I don't know what mistake it is, which part it comes from. Can anyone enlighten me? I already got the postgresql jdbc driver in libs.
When I run it with intellij, it said:
/Users/alvinpeng/.sdkman/candidates/java/11.0.8.hs-adpt/bin/java -javaagent:/Users/alvinpeng/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/202.7319.50/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=51001:/Users/alvinpeng/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/202.7319.50/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/alvinpeng/Desktop/program/out/production/classes:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/28.2-jre/8ec9ed76528425762174f0011ce8f74ad845b756/guava-28.2-jre.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1dcf1de382a0bf95a3d8b0849546c88bac1292c9/failureaccess-1.0.1.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/b421526c5f297295adef1c886e5246c39d4ac629/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/25ea2e8b0c338a877313bd4672d3fe056ea78f0d/jsr305-3.0.2.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/2.10.0/5786699a0cb71f9dc32e6cca1d665eef07a0882f/checker-qual-2.10.0.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.3.4/dac170e4594de319655ffb62f41cbd6dbb5e601e/error_prone_annotations-2.3.4.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/ba035118bc8bac37d7eff77700720999acd9986d/j2objc-annotations-1.3.jar program.App
Unable to load the class. Terminating the program
Process finished with exit code 255
When I tried to run it with gradle, it said:
The client will now receive all logging from the daemon (pid: 2592). The daemon log file: /Users/alvinpeng/.gradle/daemon/6.4/daemon-2592.out.log
Starting 7th build in daemon [uptime: 1 hrs 55 mins 42.971 secs, performance: 96%, non-heap usage: 22% of 268.4 MB]
Using 8 worker leases.
Starting Build
Settings evaluated using settings file '/Users/alvinpeng/Desktop/program/settings.gradle'.
Projects loaded. Root project using build file '/Users/alvinpeng/Desktop/program/build.gradle'.
Included projects: [root project 'program']
> Configure project :
Evaluating root project 'program' using build file '/Users/alvinpeng/Desktop/program/build.gradle'.
All projects evaluated.
Selected primary task 'App.main()' from project :
Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':App.main()']
Tasks that were excluded: []
:compileJava (Thread[Execution worker for ':',5,main]) started.
> Task :compileJava UP-TO-DATE
Caching disabled for task ':compileJava' because:
Build cache is disabled
Skipping task ':compileJava' as it is up-to-date.
:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 0.018 secs.
:processResources (Thread[Execution worker for ':',5,main]) started.
> Task :processResources NO-SOURCE
Skipping task ':processResources' as it has no source files and no previous output files.
:processResources (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:classes (Thread[Execution worker for ':',5,main]) started.
> Task :classes UP-TO-DATE
Skipping task ':classes' as it has no actions.
:classes (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:App.main() (Thread[Execution worker for ':',5,main]) started.
> Task :App.main() FAILED
Caching disabled for task ':App.main()' because:
Build cache is disabled
Task ':App.main()' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Starting process 'command '/Users/alvinpeng/.sdkman/candidates/java/11.0.8.hs-adpt/bin/java''. Working directory: /Users/alvinpeng/Desktop/program Command: /Users/alvinpeng/.sdkman/candidates/java/11.0.8.hs-adpt/bin/java -Dfile.encoding=UTF-8 -Duser.country=AU -Duser.language=en -Duser.variant -cp /Users/alvinpeng/Desktop/program/build/classes/java/main:/Users/alvinpeng/Desktop/program/build/resources/main:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/28.2-jre/8ec9ed76528425762174f0011ce8f74ad845b756/guava-28.2-jre.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.guava/failureaccess/1.0.1/1dcf1de382a0bf95a3d8b0849546c88bac1292c9/failureaccess-1.0.1.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/b421526c5f297295adef1c886e5246c39d4ac629/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/25ea2e8b0c338a877313bd4672d3fe056ea78f0d/jsr305-3.0.2.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/org.checkerframework/checker-qual/2.10.0/5786699a0cb71f9dc32e6cca1d665eef07a0882f/checker-qual-2.10.0.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.3.4/dac170e4594de319655ffb62f41cbd6dbb5e601e/error_prone_annotations-2.3.4.jar:/Users/alvinpeng/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/1.3/ba035118bc8bac37d7eff77700720999acd9986d/j2objc-annotations-1.3.jar program.App
Successfully started process 'command '/Users/alvinpeng/.sdkman/candidates/java/11.0.8.hs-adpt/bin/java''
Unable to load the class. Terminating the program
:App.main() (Thread[Execution worker for ':',5,main]) completed. Took 0.123 secs.
2 actionable tasks: 1 executed, 1 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':App.main()'.
> Process 'command '/Users/alvinpeng/.sdkman/candidates/java/11.0.8.hs-adpt/bin/java'' finished with non-zero exit value 255
get_connection function:
main function:
JDBC driver jar is not in the classpath.
I already got the postgresql jdbc driver in libs
If you have it in the local directly for the Gradle based project you also need to adjust build.gradle file to include the local jars into classpath like described here:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
However, it should be much easier to just include the repository dependency so that Gradle can download and configure the driver automatically.
dependencies {
compile group: 'org.postgresql', name: 'postgresql', version: '9.4-1206-jdbc42'
}
Not sure what JDBC driver version you need for this project. You can check this link for all the available versions and adjust the dependency in build.gradle.
Don't forget to reimport the project so that IDE knows about the new dependencies.
For the projects not using Gradle/Maven the JDBC jar needs to be added to the module dependencies manually.
I dug around option and source code but still unsure how to debug a bazel build, java specifically.
Also anyone know how I can change bazel, build it locally and use it on builds to verify. I found bazel invocation:
exec -a "$0" "${BAZEL_REAL}" "$#"
where BAZEL_REAL is a binary: /usr/local/Cellar/bazel/0.15.2/libexec/bin/bazel-real
But this doesn't explain closely how it starts and how I can debug it...
Like is it possible to jump in and debug com.google.devtools.build.lib.bazel.rules.java.BazelJavaLibraryRule while building my code? Like if I build my code with Maven, I can do mvnDebug.
bazel build -s
➜ bazel git:(master) ✗ bazel build //examples/java-native/src/main/java/com/example/myproject:hello-world -s
BAZEL_REAL==/usr/local/Cellar/bazel/0.15.2/libexec/bin/bazel-real
INFO: Analysed target //examples/java-native/src/main/java/com/example/myproject:hello-world (15 packages loaded).
INFO: Found 1 target...
Target //examples/java-native/src/main/java/com/example/myproject:hello-world up-to-date:
bazel-bin/examples/java-native/src/main/java/com/example/myproject/hello-world.jar
bazel-bin/examples/java-native/src/main/java/com/example/myproject/hello-world
INFO: Elapsed time: 4.943s, Critical Path: 0.29s
INFO: 0 processes.
INFO: Build completed successfully, 2 total actions
nevermind me, https://www.bazel.build/contributing.html#setting-up-your-coding-environment has the info I need.
Basically for starter
bazel --host_jvm_debug build //:*
the order of args are significant. For example below will NOT work
bazel build //:* --host_jvm_debug
To debug worker's jvm, get the command with bazel build -s, then append the remote debug startup opts.