I’m trying to upgrade some old code that used the Jetty plugin in Gradle. I would like to upgrade the Gradle version beyond Gradle v3.5, but Gradle v4.0 and above has the Jetty plugin removed. Unfortunately, we are now required to use Gretty.
I’m using IntelliJ. My problems with the newer Gretty plugin are:
JVM Args and System properties specified on the commandline have to be manually put into the Gretty configuration.
At least in IntelliJ, I could do out of the box debugging with the Jetty plugin, but need to run two executions including the app and the Remote, and use a different Gradle task for debugging (e.g. jettyRunDebug) with Gretty.
What are the alternatives to Gretty? Anything that can substitute for the old Jetty plugin.
How about just skipping the Gretty plugin entirely and just using Unit testing?
See: https://stackoverflow.com/a/29759263/775715
Related
I am learning gradle. I am not able to understand the gradle docs since i am a beginner. can anyone guide me on how to replace the configurations of different gradle plugins in build.gradle files as single custom gradle plugin using extensions to configure
I have a JavaFX project I am working on using Gradle. What version of java is used when I use the gradle run task from the application plugin?
In IntelliJ I can go into the Gradle settings and change the "Gradle JVM" to any version I want. Is this just the version of java that is used to run the build? Or is this also the version that my application will be run on?
Where does my JAVA_HOME come into this, if at all?
Irrespective of IDEs, Gradle will use whatever language level of the JVM that is running Gradle. Typically whatever the value is for JAVA_HOME.
See Environment variables and Targeting a specific Java version
The new way to do it as of Gradle 6.7 is to use Toolchains for JVM projects
Your IDE should respect whatever Gradle configuration that is configured.
It may be just that I have a general misunderstanding how gradle build works, but it feels to me that I can not build a maven file inside of a gradle build. Since gradle uses the gradle.build file, and maven uses a pom.xml, it does not seem as though I can do this. I have multiple maven projects that I would like to wrap up with a gradle wrapper. I can not find ANYTHING on whether this is even possible.
Both Maven and Gradle are build tools and you should only use one of them for a given project.
If you have existing Maven projects and like the functionality provided by the Gradle wrapper, there is a similar wrapper for Maven (note that this is currently a third-party plugin but they plan to include it in the upcoming release 3.7 of Maven).
Alternatively you could convert your projects entirely to Gradle.
I am using Gretty plugin for running web application from Gradle script. Is it possible to select a specific version of jetty container to run? Not just jetty9 vs jetty8, but e.g. 9.2.13.v20150730
Since Gretty 2.0.0 it is possible to override versions of Jetty and servlet-api using gradle.properties file: http://akhikhl.github.io/gretty-doc/Overriding-servlet-container-versions.html
For instance:
jetty9Version = 9.2.22.v20170606
I am using the tomcat plugin to start Tomcat server using a war file i have built using the war plugin.
Before the app starts i need to set some environment variables.
Is there a way to do that?
From what I can see in the Gradle Tomcat plugin docs, the plugin runs Tomcat in the Gradle process. Environment variables for that process can only be set from outside Gradle, in a manner appropriate for your environment/OS. Alternatively, you might want to look into the Gradle Cargo and Gradle Arquillian plugins, which can also run containers in an external process.
PS: Please don't double-post here and on http://forums.gradle.org.