Why does gradle project creation take SO LONG with eclipse STS plugin? - eclipse

I just installed a brand new eclipse mars and Spring Tool Suite 3.7.1. And I started with an empty workspace.
I create a gradle project as below:
But it seems to take forever to Create Gradle project.. as below:
Even I force to exit eclipse, it remains there and block the eclipse from exiting. As below:
I have to kill it with task manager.
Why is it so difficult to create a simple gradle project?
ADD 1
Just see this, it seems working.
https://www.timroes.de/2013/09/12/speed-up-gradle/

It takes a long time the first time because all the dependencies are being downloaded to local cache as part of the project setup. Just be patient it should complete eventually (unless there's something preventing gradle from accessing the internet).
The second project you create should be a lot faster as all the dependencies will already be locally cached.

If it already took too much time during the build. Then probably everything got downloaded. Just try switching off the internet during import. That worked for me...

Related

Prevent the download of Gradle and Maven dependencies

Before asking my question I'd like to apologize if this is really a
simple question.
I'm trying to find out the way, where we can locate and reuse the dependencies of Gradle and Maven. I want to find the possibilities of reusing them within multiple projects at the same time, opened in STS, Eclipse or Intellij.
Instead of download them every time when we create a new project. It will save me the data, time and disk space.
Maven dependencies are not downloaded again every time you create a new project.
They are downloaded to the local repository of your computer once and then they are read from there. So as long as you open a new project on the same account, Maven does not redownload dependencies.
The exception are SNAPSHOT dependencies, for which Maven periodically looks for new updates in the remote repositories.
Gradle, like Maven, has an Offline Mode, which means you're telling it to always try to re-use cached dependencies instead of resolving them from network.
Each of the dependency manager has a command line option for this, but in IntelliJ IDEA you can enable/disable it simply by toggling an icon-button in the Gradle toolbar.
And the same for Maven.

Run/Debug Apache Fineract using Eclipse??

Github guides suggest building the war and running in embedded tomcat through gradle wrapper....
This takes a lot of time to implement code changes.....I would like to run the project from Eclipse/IntelliJ and debug, hot code replacement, etc.
The wiki guides to do this are outdated, did not worked for me because there are problems in the build path, the main class cannot be found, etc.
https://github.com/MifosX-WITH-PENTAHO/incubator-fineract
Apparently, the only way to do run/debug the project is running using embedded gradle task and attaching remote debugger to it:
http://osdir.com/apache-fineract-developers/msg02767.html

What is netbeans doing now?

This is getting tedious. I created a test project, simple java hello, to test a problem I have in another project. Having created the project, I could run it and build it to a jar.
Then I added some ivy stuff and tried a build which did not work. The ivy stuff consisted of ivy.xml ivysettings.xml and 2 tasks added to the otherwise default netbeans build.xml.
So then I removed the ivy files and the ivy sections from build.xml. I then did a diff on that and the previous unedited build.xml file and they are identical.
So now why after a clean build do I get this error?
/home/tester/WORKSPACE/NetBeans/Foo/nbproject/build-impl.xml:63: Source resource does not exist: /home/tester/WORKSPACE/NetBeans/Foo/lib/nblibraries.properties
Correct that file does not exist and it does not exist in any other project I have access to whether they use ivy or not.
I have reset everything I did yet Netbeans cannot continue. I have tried to work out how the hell nb actually builds a project but got lost. Just don't know what to say.
I guess nb and myself differ on what clean actually means and also on whether a task should be able to produce exact same results everytime given the same input, something that nb does not seem to be able to do. That or it cannot recover from the real world or their documentation just hides the useful information like how to reset a project.
I'm assuming there is some nb state that needs to be cleaned up manually but have no idea where to start. Any ideas please?
#Tim Biegeleisen, your comment got me thinking.
I shut down/restarted netbeans then tried the build again and it worked. So it seems that ivy is still running inside netbeans and has some form of state for my project that it will not release. I'll have to dig around to see if there is a way to reset ivy state without restarting nb but this whole process is turning in to a very tedious onerous task. I seem to be spending more time on the dev tools than I am on solving my coding tasks.
So the solution/workaround to my problem seems to be to restart netbeans to clear ivy state.

best way to enable hot deployment on Jetty when using Gradle+Eclipse

I'm used to mvn, but I'm testing Gradle (v1.8) for a small web development project.
I've noticed that the Jetty Gradle plugin support autoscan and hot deployment, so I've enabled it. My goal is to recompile from Eclipse and get a Jetty reload the context every time I change a Controller, etc.
However, this is non working, mainly because Gradle compilation output goes to build/, however the Gradle Eclipse plugin creates a .classpath configuration that directs all the Eclipse output to /bin (even mixing test and main source folders).
Is there a way to?...
Run graddle jettyRun on a separate console.
Save a modified class on Eclipse (triggering a compilation)
See that Jetty picks up the change and reloads the context.
As per my research, I've identified three workarounds, but none of them solves the question above (I'm posting them in case you have related comments or more recommendations)
Tweak Gradle Eclipse config to direct test and main build output to the same directory that Gradle uses (using the pattern seen here). This is not recommended by some people, as it means using two different compilation systems that could interfere with each other.
Use the Gradle eclipse-wtp plugin to generate a WTP2 config, and use Eclipse's "Run AS -> Run on Server". This accomplishes the hot deployment / iterative goal and keeps both systems (IDE and Gradle) isolated. However, you need to setup the server on Eclipse.
(Not really a workaround): I've tested Spring's Eclipse build (STS) Gradle integration, however it seems that the integration is focused on the project setup, and while Gradle builds can be automatically triggered, Eclipse compilation is still redirected to bin/.
So you are interested in fine-tuning hot-deployment, right?
Please, consider using Gretty gradle plugin: https://github.com/akhikhl/gretty
It is an advanced gradle plugin for running web-apps on jetty. It does exactly what you want, regarding hot-deployment (and, possibly, even more).
Disclosure: I am author of Gretty plugin.
If you don't want to change to other plugins, here are two steps for the workaround:
add below configurations into your build.gradle:
jettyRun {
reload = "automatic"
scanIntervalSeconds = 1
}
each time after you changed java code, run the following task:
gradle compileJava
Because jetty is watching the *.class files, it will hot reload only after *.class files changed.
Refer to this link: https://discuss.gradle.org/t/hot-deploy-with-jetty-plugins-jettyrun/7416

How to configure the web container to run continuously so it will perform a hot redeploy using GRADLE jetty?

According to gradle.org :
Once started, the web container can be configured to run continuously,
scanning for changes in the project and automatically performing a hot
redeploy when necessary.
Searching around I can find a lot related to maven but the project I am working on uses gradle. I have the gradle jetty plugin installed but can not work out how to set it to hot redeploy when I have made changes to a html+thymeleaf file.
This should work:
apply plugin: "jetty"
jettyRun {
scanIntervalSeconds = 10
}
The scanIntervalSeconds and reload properties are inadvertently not listed on the JettyRun page of the Gradle Build Language Reference (fixed for Gradle 1.7), but the page links to the Groovydoc ("API Documentation" on the top), where you can find them on the superclass.
So, I've been looking for a way to hot deploy for a few days using the jetty plugin for gradle. I had no luck whatsoever with:
reload = "automatic"
scanIntervalSeconds = 1.
Jetty checks the build for any changes, whereas the changes that take place are in src. Changing jetty to watch the src folder seemed messy to me.
Instead I used the tomcat plugin for gradle.
Just follow the usage section on https://github.com/bmuschko/gradle-tomcat-plugin
Hot deployment is already configured in the plugin so just making the requisite changes to build.gradle did the trick. Hot deployment with gradle works for me now... a HUGE timesaver :)
If anyone has been able to hot deploy using jetty with gradle please share the process... until then tomcat is the way to go