I want to converte my Maven project to Gradle.
In official Gradle docs is written "All you have to do is run the command
'$ gradle init'
from the root project directory and let Gradle do its thing.",but I can't understand one thing - where exactly in the root project directory i should write this init command.
I tried to cd into the project directory in Windows Terminal and after this run init gradle but it doesn't work.
This is my project directory
Can someone help me?
Related
I have completed my JavaFX application within gradle build system, and it is working fine in all way. Now I want to export as a .EXE file for standalone software distribution, I tried much more tricks but no gain. If some one can help me out to wrap my project in a software setup, It would be grateful.
Follow these steps to export your JavaFX project into executable Jar
Goto> Project Structure
Goto>>Artifacts
Click "+">> To add new artifact
It will shows a dropdownlist
Select>>Jar>>From module with dependencies
You will see a nested window as shown
Select Main class of your project
Check In the Option " Copy to output directory.." >>Ok
Goto>> Menu-bar>>Build>>Build Artifacts
Select>> your Project.jar>> Build
This will create executable jar file in your project source folder
Locate your jar file in path project\out\artifacts..
Now you can run this jar file simple cmd commad or with batch file
Cmd Command>> Java -jar project.jar
Using batch file>> make .bat file name it "RUN" and write these commands inside
Specify the Java Runtime path and "Javafx Sdk path" along with VM
options & Project Jar
Run your standalone application .. Enjoy ;)
Creating an installer for the desktop platforms (Windows, macOS, Linux) has become easy these days. The tool of choice is jpackage which started to be shipped with JDK 14. It can either be used on the command line on the finished project or you can use a Gradle plugin (https://github.com/beryx/badass-jlink-plugin). If your project is not modularized you could follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which also uses jpackage but together with Maven and some other tools from the JDK. The Maven part could easily be rewritten to Gradle, if needed.
In my spring Boot web app I have added the Gradle Wrapper to source control so that a user does not need gradle pre-installed to run my application.
My project file Structure is shown below - note the gradle folder with gradle-wrapper.jar , gradle-wrapper.properties and gradlew batch file are present.
However when try to run gradlew clean build in this folder I get:
gradlew:command not found
How can I solve this?
You're missing the . dot in your command. And from your screenshot, you're own a Windows machine so you should use the .bat script.
./gradlew.bat help
Not being able to execute the default micronaut application using basic cli commands. This problem has occured on both the Maven and Gradle default projects. I don't understand why I'm having issues running the app.
The repective default project base directories contain the mvnw and gradlew files so I don't think it's a problem with maven/gradle being out of date on my computer or anything along those lines.
I've checked the class path being passed into the arguments in both the gradlew and mvnw bat and cmd files. Their respective wrapper.jar paths are being passed in as classpath arguments.
Here's some images.
Maven error message, similar error occurs when trying to run with gradle:
Base directory of maven project:
Gradle error message:
Base directory of gradle project:
Parent directory image:
UPDATE: I just tried downloading someone else's project directory from a guide on micronauts website I unzipped it and used the ./gradlew run command, the server seems to be up and running. The zip comes with initial and completed subdirectories each with their own micronaut application inside, they run too using the same gradle command.
This leads me to believe that there was something wrong with my micronaut installation. Maybe it's shipping a faulty default application (that's not configured properly)?
It looks like you don't have the wrapper support files in your project.
~ $ mn create-app somedemoapp
| Generating Java project...
| Application created at /Users/jeffbrown/somedemoapp
~ $ cd somedemoapp/
somedemoapp $ rm -rf gradle
somedemoapp $ ./gradlew run
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
(notice that I deleted the gradle/ folder before attempting to run the project)
Some people don't check in the gradle/ directory to source code control because they don't understand its purpose.
I created a new micronaut application in my C drive with a different directory, it worked. I think it has something to do with the original path variable having too many spaces and - in it. Making the classpath (in the gradlew.bat) unreachable essentially.
I created my project in Intellij idea with maven set up.
Just I want to build executable jar with complete dependencies and run through command line.
Ex: java -jar hello.jar
An example can be found in my blog post Create an executable jar from Maven
Just make sure you can run Cucumber from your main function.
I have a Maven WEB Project that I am having problems configuring. I am trying to get the project to build a WAR and place it in the target directory when I build through Eclipse, but when I do a build, nothing appears to be happening. Is there anything special that I have to do to setup what happens when I do a build through Eclipse?
Right now, when I build, the target directory gets created and a m2e-wtp folder gets generated, not sure what that is.
Executing mvn clean install command from the directory where pom.xml is present will generate the WAR file. Sometimes IDE fails to reload the application target folder after external build. Try to refresh the workspace in Eclipse after building the application.
You can also try mvn clean install -X to run the build process in debug mode. This way you can figure out the exact problem.
Shishir