I'm building a gradle project to execute all spring cloud contracts by using the following command
./gradlew clean build
This is taking a lot of time to build. If I want to build a particular contract, I'm not able to find any command.
Any idea would be appreciated.
There's no way to do it. You can file a feature request of you're interested in adding this functionality
Related
Quite new to all things Kotlin / IntelliJ / IDEA / gradle.
I'm comparing some code in about ten languages and the Kotlin Native version is the only one that I can't figure out how to build without using the IDE.
I started the project in IntelliJ IDEA by following guides on getting started with Kotlin and this was the recommended method.
By Googling, searching the IntelliJ help, and hunting here on StackOverflow I've been unable to find the answer. Most questions are about Multiplatform and phone apps. I'm just making a macOS commandline tool for now.
Is there a way included with IntelliJ IDEA to build a project form the terminal without starting up the IDE?
Or would it actually require me to use a completely different build system and just use Kotlin Native Mono install totally separate from the IntelliJ setup? Is no shared build system possible or would that be an even more advanced proposition?
There is no need to use the IntelliJ IDEA to build the Kotlin native project.
You should be able to use the gradle build or gradle nativeBinaries command from the Terminal to build the Gradle project.
Also, you could refer to the Kotlin native documentation here for details: https://kotlinlang.org/docs/native-gradle.html
I figured it out with a bit more trial and error.
IntelliJ IDEA seems to come with gradle but doesn't put it in the path. The IntelliJ IDEA project has set up a build system that will work with gradle as is though. You don't have to set up a new one from scratch.
In my case the gradle executable was at:
/System/Volumes/Data/Users/hippietrail/.gradle/wrapper/dists/gradle-7.4.2-bin/48ivgl02cpt2ed3fh9dbalvx8/gradle-7.4.2/bin/gradle
Running gradle using the full path with no parameters looks like it's doing something and takes a while, but doesn't build the project. To build it simply add the build parameter so in my case:
/System/Volumes/Data/Users/hippietrail/.gradle/wrapper/dists/gradle-7.4.2-bin/48ivgl02cpt2ed3fh9dbalvx8/gradle-7.4.2/bin/gradle build
It seems that gradle is not in the path by design and that the intended usage is via the gradlew that IntelliJ IDEA put in my project directory for me. This is an (explicit) wrapper script for gradle. So the more straightforward invocation is:
./gradlew build
I am using a Maven repo inside a Gradle build that relies on BasicAuthentication to access its contents. If the credentials are incorrect or missing then the build fails indirectly, due to missing artefacts. However, I would much prefer it if the build could fail immediately in this case, e.g. by throwing an exception. I'm new to Gradle but despite searching the Gradle documentation I can't seem to find such a facility. I am using Gradle v7.1.1 inside Android Studio. Is this possible?
my company provides a lot of java projects for customers (typical consulting solutions). These projects are versioned in git and built with gradle and therefore contain a gradlew as recommended by Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
I am trying to find a solution to the task of updating the Gradle version for each of these individual projects. As you can imagine this is quite tedious if done manually.
The best solution I have come up yet is running a Jenkins job for each project that checks a web service for our current company-default Gradle version, runs
./gradlew wrapper --gradle-version <VERSION>
and pushes the result. Is there any better or even kind-of-standard way?
I am trying to collect the information of all third party modules we have used inside our app, which include name, version, latest version, license and provider. I can collect all of those info using mvn plug-in for the maven projects, but just cannot find a plug-in to list the providers (homepage or vendor info inside manifest). Is there any plug-in available?
Also we had some Gradle projects, what option is best to generate report without modifying the existing build.gradle file(s)?
I'm afraid there is no direct analog to the tool you want. You can get some information via dependencies or dependenciesInsight tasks, but it won't provide, for example, licensing information.
The best way to generate a report about your build without modifying any build files, IMO, is Gradle Build Scans feature. BTW, they also support Maven!
Just append --scan to the invocation command and the report will be generated:
Starting with Gradle 4.3, you can enable build scans without any additional configuration in your build script. When using the command line option --scan to publish a build scan, the required build scan plugin is applied automatically. Before the end of the build, you are asked to accept the license agreement on the command line. The following console output demonstrates the behavior.
$ ./gradlew build --scan
BUILD SUCCESSFUL in 6s
Do you accept the Gradle Cloud Services license agreement (https://gradle.com/terms-of-service)? [yes, no]
yes
Gradle Cloud Services license agreement accepted.
Publishing build scan...
https://gradle.com/s/czajmbyg73t62
If you want a quick demo, here is a build scan report for one of my public projects: https://scans.gradle.com/s/6fmoybczbores, explore it as you wish. It has a "Dependencies" section, still it has no licensing.
The other approach could be using a third-party tool that monitors the dependencies for you. One well-known is Snyk, take a look, probably it will work for you. Probably one day GitHub will be able to track the dependencies too, but as of September 2019 it is able to track only Maven projects:
I have a project, which is written using the Play Framework, say myproject-web. It is mostly a thin HTTP layer over another project, which forms the core of the entire business logic, called myproject-engine. In my build setup, myproject-web is a sbt project, whereas myproject-engine is a Gradle one.
What I want to achieve is that Play recognize myproject-engine as a dependency, and invoke gradle to build it whenever I try to build the play application (either on run, or automatically, as it happens in the dev mode) or when I do play dist. Is it possible? What is most important for me is that it automatically loads any dependencies that myproject-engine has.
Eventually, the state I want it to reach is that I host my Maven repo for these projects and then SBT can simply pull this package from over there and will get all its dependencies. Is this rather easy to setup? Even if it is, is it relatively easy to maintain?
As #Peter-Niederwieser pointed out in his comment, I think the only viable solution is to have a maven/ivy/gradle repository where the myproject-engine Gradle project is published to. With the correct resolvers the project becomes yet another project dependency, regardless of the build tool it uses.
See Resolvers in the official documentation of sbt.