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.
Related
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
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 am playing with the example project at:
https://github.com/bmuschko/gradle-in-action-source/tree/master/chapter06/listing_06_03-todo-project-dependencies
After I run the jettyRun task at the "web" subproject I got:
:model:compileJava UP-TO-DATE
:model:processResources UP-TO-DATE
:model:classes UP-TO-DATE
:model:jar UP-TO-DATE
:repository:compileJava UP-TO-DATE
:repository:processResources UP-TO-DATE
:repository:classes UP-TO-DATE
:repository:jar UP-TO-DATE
:web:compileJava UP-TO-DATE
:web:processResources UP-TO-DATE
:web:classes UP-TO-DATE
:web:jettyRun
However in the gradle it only says "web" project depends on "repository" and "repository" depends on "model" which are project level dependencies. So when you run "jettyRun" how does gradle know which tasks to run in the subproject?
When you declare that one project is dependent on another project this means that the first project is dependent on the artifact of the other project. In the java plug-in this artifact is produced by the jar task.
I am trying to generate groovydocs in gradle script using command gradle groovydoc. I can see the command executed successfully as below:
Dynamic properties are deprecated: http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:groovydoc UP-TO-DATE
BUILD SUCCESSFUL
But I don't see any API generated in the file system. What am I missing here?
Given the information you provide, it's impossible to say. We'd have to see the build scripts, output of gradle -v, etc. The first line of output indicates that you may have misspelled a configuration property in the build script. Recent versions of Gradle will print the property in question. If you get the UP-TO-DATE even for gradle clean groovydoc, it's a clear sign that something isn't configured correctly.