Using gitlab CI, can not reach to sonarqube server.
I have opened the firewall on port 9000 but can not solve the problem. Also try with replacing "localhost" with ip address
The yml file for gitlab ci -
variables:
SONAR_URL: "http://localhost:9000"
SONAR_LOGIN: "admin"
SONAR_PASSWORD: "admin"
image: gradle:latest
build:
stage: build
script:
- bash ./gradlew sonarqube -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD
only:
- master
The output from Gradle:
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
> Task :compileGroovy NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes
> Task :compileTestJava
> Task :compileTestGroovy NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
> Task :sonarqube FAILED
SonarQube server [http://localhost:9000] can not be reached
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sonarqube'.
> Unable to execute SonarQube
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 28s
4 actionable tasks: 4 executed
Related
I have a gradle project https://gist.github.com/iva-nova-e-katerina/f5428f52afa36c5f2719d047ccc53213 and run it with "./gradlew build" with following error:
└─$ ./gradlew build
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Parallel execution is an incubating feature.
> Configure project :
ArtifactoryUser user: null
Using Java from /home/katya/java (version 11.0.2)
Detected development environment
[buildinfo] Properties file path was not found! (Relevant only for builds running on a CI Server)
FAILURE: Build failed with an exception.
* Where:
Script '/home/katya/tmp_work/groovy/gradle/binarycompatibility.gradle' line: 67
* What went wrong:
Could not determine the dependencies of task ':groovy-console:japicmp'.
> Could not resolve all files for configuration ':groovy-console:detachedConfiguration1'.
> Could not resolve org.codehaus.groovy:groovy-console:2.4.16.
Required by:
project :groovy-console
> Project :groovy-console declares a dependency from configuration 'detachedConfiguration1' to configuration 'default' which is not declared in the descriptor for project :groovy-console.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Could you explain what is going on? What is 'detachedConfiguratoin1' and how to fix this error?
I am pretty new to gradle.
I am trying to do a simple tutorial on junit5 and gradle (https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-gradle/). Everything works fine when i do "./gradlew test". However, doing it the second time it gives me
$ ./gradlew test
:compileJava NO-SOURCE
:processResources NO-SOURCE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources NO-SOURCE
:testClasses UP-TO-DATE
:junitPlatformTest UP-TO-DATE
:test SKIPPED
I was under the impression that ./gradlew test should run all my tests. Why is their execution being skipped?
Thanks
It's being skipped because you just ran the tests, didn't change anything to the inputs or the outputs of the task, and running the tests again is thus unnecessary: the result will (or at least should) be identical.
See the documentation.
I am trying to run this simple example
https://github.com/gradle/oreilly-gradle-book-examples/tree/master/web-hello-world
after cloning the repo,
cd oreilly-gradle-book-examples/web-hello-world
gradle JettyRun
Seems to be working fine
compileJava UP-TO-DATE
:processResources NO-SOURCE
:classes UP-TO-DATE
> Building 75% > :jettyRun > Running at http://localhost:8080/web-hello-world
When I access that URL though, I simply get
Directory: /web-hello-world/
web.xml 555 bytes Jul 30, 2017 4:55:48 PM
so the servlet code isnt being called.
Using Gradle 3.4.1
Any idea?
Thanks!
I tried gluonmobile 4.1.0 and 4.2.0, when I run the "debug" task(Tasks/application/debug), it just blocks:
Executing external task 'debug'...
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileDesktopJava UP-TO-DATE
:processDesktopResources UP-TO-DATE
:desktopClasses UP-TO-DATE
:debug
Listening for transport dt_socket at address: 5005
(Blocking forever....)
In Eclipse e.g. you can create a Debug Configuration of type Remote Java Application which will be attached to the corresponding socket:
After you have started the gradle task debug you then have to start the Debug Configuration.
I’m using Gradle 2.7 on Mac Yosemite. When building my WAR, assuming all the tests pass and assembly of the war is successful, I’d like to copy my WAR to my local $CATALINA_HOME/wbeapps directory. So I have defined this in my build.gradle script:
task deployToTomcat(type: Copy) {
from war.archivePath
into "$System.env.CATALINA_HOME/webapps"
}
build.dependsOn deployToTomcat
When I run gradle build I can see that the task is run, but nothing appears in my $CATALINA_HOME/webapps directory. Here is the output:
davea$ gradle build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:war UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:update
liquibase-plugin: Running the 'main' activity...
INFO 10/28/15 2:11 PM: liquibase: Successfully acquired change log lock
INFO 10/28/15 2:11 PM: liquibase: Reading from cbc_db.DATABASECHANGELOG
INFO 10/28/15 2:11 PM: liquibase: Successfully released change log lock
Liquibase Update Successful
liquibase-plugin: Running the 'test' activity...
INFO 10/28/15 2:11 PM: liquibase: Successfully acquired change log lock
INFO 10/28/15 2:11 PM: liquibase: Reading from PUBLIC.DATABASECHANGELOG
INFO 10/28/15 2:11 PM: liquibase: Successfully released change log lock
Liquibase Update Successful
:testClasses
:test UP-TO-DATE
:check UP-TO-DATE
:deployToTomcat UP-TO-DATE
:build UP-TO-DATE
Does “UP-TO-DATE” mean it was run? How can I force the task to run?
Edit: In response to the answer given, I changed my task. The WAR file gets copied to a folder named "null/webapps" in the same directory as my "build.gradle" file. Here is the output
davea$ echo $CATALINA_HOME
/opt/apache-tomcat-6.0.44
davea$ gradle build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:war UP-TO-DATE
:deployToTomcat UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:update
liquibase-plugin: Running the 'main' activity...
INFO 10/29/15 9:09 AM: liquibase: Successfully acquired change log lock
INFO 10/29/15 9:09 AM: liquibase: Reading from cbc_db.DATABASECHANGELOG
INFO 10/29/15 9:09 AM: liquibase: Successfully released change log lock
Liquibase Update Successful
liquibase-plugin: Running the 'test' activity...
INFO 10/29/15 9:09 AM: liquibase: Successfully acquired change log lock
INFO 10/29/15 9:09 AM: liquibase: Reading from PUBLIC.DATABASECHANGELOG
INFO 10/29/15 9:09 AM: liquibase: Successfully released change log lock
Liquibase Update Successful
:testClasses
:test UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE
BUILD SUCCESSFUL
Total time: 0.865 secs
There's no need to force task to be run. Instead please configure the tasks appropriately:
task deployToTomcat(type: Copy) {
from war.outputs
into "$System.env.CATALINA_HOME/webapps"
}
war.finalizedBy deployToTomcat
archivePath defines the path where war will be placed but to get the war you need to use task's outputs property.
finalizedBy runs given task always after the tasks it finalizes. In this particular case this guarantees that the artifact being built will be prepared.
UP-TO-DATE means that the task wasn't run. It had nothing to do.