How to run gradle on windows - java

How to convert existing Maven project to Gradle project?
I read many answers in for the same. But I'm stuck at a point and don't know how to proceed.
Steps I followed:
installed Gradle 2.7
Added Gradle home and path in environment
checked Gradle -v cmd from C: directory. Working fine.
trying to run Gradle init command from project directory. NONE OF THE GRADLE CMD IS WORKING FROM PROJECT DIRECTORY. "Gradle CMD not recognised". My project is a complete maven spring cloud stream project.
Kindly let me know what I might be doing wrong and how to make it work.

Related

Gradle project doesn't build on my machine, but does on everyone else's

I'm trying to start some work on a Gradle project, but I get a strange error when attempting to build the project on my machine. Currently, we have a Gradle project that builds successfully for all other members of my team, all they need to do is clone the project and it builds without any problems. For myself, that isn't the case.
If I execute the gradle wrapper manually from the terminal:
./gradlew build
the project builds without any errors, but the Gradle synchronisation fails when importing the project into an IDE, giving the following error:
* What went wrong:
Could not resolve all dependencies for configuration ':billing-
provisioning-consumer-finance-details:compile'
I assume that it can't be a problem with the project structure, nor anything wrong with the build.gradle, since it builds without error on other machines.
So far I've tried:
Re-cloning the project (several times)
Clearing the gradle cache at ~/.gradle/caches
Clearing ~/.m2/repositories
Building the project in another IDE (Eclipse), which still gives the same error.
You can follow these steps :
Download Gradle from Gradle
Create or Export GRADLE_HOME as environment variable.Ex: E:\SoftwareRepo\building tools\gradle-4.4.1
Add to Path or Export Path Variable PATH=[YOUR GRADLE_HOME/bin] . ex. E:\SoftwareRepo\building tools\gradle-4.4.1\bin
Open cmd or terminal anywhere in your PC and run gradle --v . If gradle install successfully it will show installed gradle info.
Clone your gradle project
Go to project root directory. Open terminal and run gradle clean build
If there is still error then it will be probably your project is not correctly configured.
If you tried with intelij idea then you need to try this
File->Open. then select your source folder.
then a popup will come select local destribution gradle

How to run maven project on jetty in Intellij as in Eclipse?

Maven project (project name: english) [vaadin, jetty] runs in Eclipse without any problem. How to run/configure exactly the same project in Intellij? Run/Apply options are not available after below configuration. In Eclipse I set, Base directory [${workspace_loc:/english}], Goals [jetty:run], JRE, Source (english project). How to set it in Intellij?
eclipse1
eclipse2
eclipse3
intellij1
intellij2
First things first, you need to add jetty plugin for maven as a dependency, if you don't have it already in your pom.xml. More about jetty maven plugin can be found here
If you were running the project via embedded jetty plugin in eclipse, same pom.xml configuration should run successfully run when you issue same command in intellij IDE.
If there are any issues on your build, try with a "clean rebuild" before you start doing anything else. You can do that via the following command in your terminal:
mvn clean install jetty:run
You will need access your console (terminal), i.e. via Alt + F12 keys. You also need to be in the same directory that you have the pom.xml in your project.
The command will basically clean up (i.e. delete) previously build project and do a fresh rebuild of your project, then run it via embedded jetty plugin.
Be sure to read a brief introduction to maven commands: Maven in 5 minutes if needed.
After you successfully issued this command for the first time, I think you can can also issue jetty:run via View -> Tool windows -> maven project.
You can usually access it also on your right side of intellij IDE (the "m" icon, maven projects).

maven build on jenkins not allowing to create/genarte any files in project

I have created a java project which has implemented cucumber and Junit.
When I am running the project from my IDE the reports and snapshots are generating finely but after pushing the code when my build is run by Jenkins, none of the reports and snapshot is generating in my workspace. My build also showing success without any issue, just the files are not created.
Configuration :-
Window 10
Jenkins.war -> Jenkins ver. 2.74
I am using the below command from terminal which is working fine
mvn clean install
In Jenkins maven plug-in, I have set goal as
clean install
I have also giving Full control permission to Jenkins war from properties->security.
It looks like a permission issue to me but what exactly it is?
I have also change the workspace from c driver to d still facing the same issue
In configure -> build -> Root POM, the path of POM file should be of your Jenkins workspace projects not of your local/development env

Gradle Installation Not Configured Correctly

I installed Eclipse Neon and went to the marketplace and installed the Gradle IDE Pack 3.8.x + 1.0.x plugin. When I right click on the build.gradle file and choose run as > gradle build Gradle build I get an error that says "Gradle installation is not correctly configured go to Window -> Preferences -> Gradle(Enide) and configure the correct location.
I've tried multiple locations, including C:\ProgramData\chocolatey\lib\gradle\tools\gradle-3.1\bin, but none of them seem to be working.
Any and all help would be much appreciated!
EDIT: Also, I'm not sure if this is related but when I try "gradle build gradle" in the command prompt it says "Task 'gradle' not found in root project".
I've done some searching for both of these issue but don't seem to find then answer that seems right for my situation. I've used gradle before but never set it up in a new project.
Ok, after trying to figure this out for the past 24 hours, I found out that when I ran "choco install gradle", it didn't install the most recent version of Gradle. I uninstalled that, downloaded and unzipped the current version (3.3) and pointed the GRADLE_HOME environment variable to the new directory and changed the Gradle directory in the PATH env variable, I was able to run it in Eclipse. gradle build gradle still isn't working for me but gradle build is. As far as I'm concerned, this is working as desired now.
The only reason I was trying to use gradle build gradle was because of past experiences but maybe that was something that was already setup in the project? I'm not really sure but this seems like it's working the way it is supposed ot now!

Gradle IDEA Plugin can't find JDK on Mac

PLEASE NOTE: THIS IS NOT A DUPLICATE. I want Gradle's IDEA plugin to correctly configure my IntelliJ IDEA CE project for me. I am not interested in any solution that involves manually tuning IntelliJ to find my JDK. This is a Gradle IDEA plugin feature that can and should work.
If you can find another question that involves correctly getting the Gradle IDEA plugin to configure IntelliJ (running on a Mac) so that it can find JDK 8+, then please by all means, mark this as a dupe and provide a link to that question. Otherwise, do not vote this as a dupe (it's not!).
Mac 10.9.5 here. Java 8 is my default JRE/JDK, and I just installed Groovy 2.4.6 and Gradle 2.13 via sdkman. I then installed IntelliJ IDEA CE.
On my terminal, I created a test-proj directory, and then inside that directory I issued the following Gradle command:
gradle init --type groovy-library
Gradle executed successfully, giving me a Groovy project skeleton. I then edited the generated build.gradle to contain the IDEA plugin:
apply plugin: 'idea'
And then I ran:
gradle wrapper
./gradlew clean idea
This generated the Gradle Wrapper for me, and I then used the IDEA plugin to generate IntelliJ project files for me. I then opened my brand-spanking-new IntelliJ IDE and went to Open my test-proj.
The project opened and everything appeared to be OK. But then I started coding and noticed that JRE classes such as String were not showing up as resolvable. So I went to File >> Project Structure and see this:
So it appears that IntelliJ can't find my default Java 8 JDK. I know the OS can find both the JRE and the JDK, based on the console ouput of java -version and javac -version. But something, between sdkman, Gradle or IntelliJ is preventing the IDE from finding Java. Any ideas?
I had the same problem, although i got it running by removing the .idea folder and reimporting the project by pointing to my build.gradle file. In the import dialog i selected the .ipr structure instead of using the idea "folder based structure" (default)
When executing gradle idea it will then generate an .ipr file in your project root configuring your project.
In my case the jdk was set properly and my modules were initialized correctly.
The reason behind using the .ipr files is, that the gradle idea plugin can't work with the directory based structure. See also:
directory based idea project with gradle
https://issues.gradle.org/browse/GRADLE-1041 (open for 6 years now)
Since i figured this out today i'm not sure how good this is working. Or what are the differences between directory based and .ipr based (.ipr based seems older?).

Categories

Resources