My builds broke when I moved to Gradle 5 becasue Gradle v5.2 bundles with Groovy v2.5.4. These projects use the dynamic support build for Groovy.
Invoke dynamic support
groovy-all-2.5.4-indy.jar
This file is not being resolved for either JCenter or MavenCentral. However I did find a copy here:
Sonatyoe repo: https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.5.4/
groovy-2.5.4-indy.jar
but no groovy-all-2.5.4-indy.jar
I am not sure what can be done for Gradle to 'resolve' this file and actually find it.
Can someone tell me were I should be getting this JAR file from?
I'm using coordinates: "org.codehaus.groovy:groovy-all:2.5.4:indy"
Is that still the correct expression?
Is this a bug or am I just looking in the wrong places (see #1)?
Im ny build.gradle I was using jcenter() and tried changing that to mavenCentral().
Neither option came up with the JAR in question.
A final wrinkle is that we run an instance of Nexus. Is there some way to force Nexus to go outside and look-for this JAR?
This is not entirely conclusive, but it seems that the -indy jar was there in groovy versions prior to 2.5.0 because those versions supported java versions prior to 1.7.
The indy jar was there so that you could optionally enable support for the invokedynamic instruction introduced in java 1.7 while still supporting java versions prior to 1.7 which did not include invokedynamic (groovy docs for indy).
It seems that groovy 2.5 bumped the minimum jdk requirement to, quote:
JDK requirements changes
Groovy 2.5 requires JDK8+ to build and JDK7 is the minimum version of the JRE that we support.
(from http://groovy-lang.org/releasenotes/groovy-2.5.html)
which would make this whole duality of supporting both invokedynamic and without unnecessary.
So my guess would be that they just dumped the indy jar and always include the invokedynamic instruction in the normal groovy jar file set as the required jdk versions will always include it.
Related
I am new to gradle. But I do understand to some extent why developers are encouraged to use gradlew instead of gradle. However what worse could happen if developers use different versions of gradle to build their project? At the end of the day any gradle version makes sure that dependencies of the project is managed properly. For example if a Spring Boot project is dependent of a starter plugin version 2.x, no matter what version of gradle is used, the build tool makes sure that 2.x is available
As far as I'm aware the main point to use a common version of Gradle is plugin compatibility.
Gradle's internal APIs changed quite a lot in the last few versions, so not every plugin works with every Gradle version.
For example: Spring Boot's 2.3.4 reference explicitly states that it's build plugin requires Gradle 6.3 or later (although 5.6 is mentioned to work in a deprecated form)
https://docs.spring.io/spring-boot/docs/2.3.x/reference/htmlsingle/#getting-started-system-requirements
So while you can be sure that the Spring Boot version is used (because you defined it in your buildfile) any older version of Gradle is likely to run into Exceptions when trying to build your project.
Even if you're just using plugins that are provided by Gradle itself there can be compatibility issues. For example the java configuration block was first introduced in Gradle 5 (I think) and therefore would cause a syntax error in earlier versions.
Or simple things like Java versions that older version of Gradle do not support.
The more plugins you use it becomes increasingly unlikely that a lot of Gradle versions will be able to run it. Using the Gradle Wrapper is therefore a simple way that your build works for everyone.
And from the other perspecitve: if you are the one that usually maintains the build you can use all the latest Gradle features using the Wrapper as you can be sure it will not break anything. Getting everyone on the team to update manually before you can use a feature can be a pain
That beeing said, it's really primarly a maintenance issue. Nothing bad can happen if anyone uses their own installed version of gradle, except it might just not work
If everyone on the team uses a similar version nothing might happen at all
My project is giving me an "Illegal Reflective" warning, which seems to be a problem before Groovy v3.0. However, Gradle on my machine is running Groovy v2.5.4 and I can't seem to bump this to > 3.0. I've tried having "compile 'org.codehaus.groovy:groovy-all:3.0.2'" in my dependencies but this doesn't do anything.
How can I bump the version of Groovy that Gradle uses?
Gradle has an internal Groovy it uses to run Gradle itself. Declaring a compile dependency on Groovy will not change that. To change the internal Groovy version the only way I know is to go to the lib directory of your installed Gradle and replace the groovy jars in there.
But I advise against doing that. You may see side effects. Groovy 3 contains breaking changes and I do not know if they impact Gradle. Some of them impacted Grails, which is why we already have 3.0.2 despite 3.0 being quite new.
The "Illegal Reflective" warning is just that, a warning. It is only there to try to force library makers to quit doing what they (the makers of the Java API) declared as wrong and warn they will enforce it at some point. But JDK11 is not yet that point.
Maven by default uses these versions of plugins such as clean, compile, jar etc. if I don't override them in my pom.xml.
Should I be using more recent version of these plugins? For example, the current version of maven-compiler-plugin is 3.6.1 while the default is 2.5.1. Or, are the default versions reasonable enough that anyone not consciously depending on newer features need worry?
The maven way is "convention over configuration", so if you're wondering about not using the default parameters when running a maven build, you should have a specific use case that is not covered by the default version.
Here for example, (according to here) the install plugin is still at version 2.5.2, so that would point to me that using 2.5.1 is not such a bad choice by default.
I think the biggest difference comparing version (I might be wrong) is the upgrading of compatible version as for example this pseudo release note of the maven compiler.
Has anyone got the Acceleo Maven build to work?
If so what combination of Maven, Tycho, Eclipse, Acceleo, UML2/ecore worked for you?
And as a supplementary question do you still need to adjust the Java classes and config files before running the build (as was required for the old ANT build)?
To be clearer tycho does not like Maven 3.3, Maven 3.3 is the default with Luna. Every version of Eclipse has a different version of the ecore/uml model built in so migrating the Acceleo templates to another version of eclipse requires changes in all "module" definitions and hacking the version inside the UML models, so, its tedious trying to work out which versions are compatible.
I just wondered if someone had a working setup where all the components worked together.
After much trial and error:-
Eclipse Luna
Comes with Eclipse m2e 1.5
ecore uml2 version 5.0.2
Acceleo 3.5.1
Maven 3.0.5
org.eclipse.acceleo:org.eclipse.acceleo.maven:3.5.0-SNAPSHOT
All work together without the usual class not found and missing jars.
However I have yet to build a working pom that actually generates some
template output.
Interestingly the ANT build seems to work fine.
In the end it was just easier to knock up a .bat script to run
the generate and build.
You can have a look at the UML to Java generator of the Eclipse Foundation for the configuration of the pom.xml. For additional information on the use of maven with Acceleo, look at the dedicated page on the wiki.
You do not need to modify any Java class or configuration file now.
I have a project that uses some Java and some Groovy, and it's all built with Maven. We use the GMaven plugin to compile the Groovy. I've been using Eclipse and have got fed up with the "Plugin execution not covered by lifecycle" message that indicates Eclipse is incapable of doing what my command-line does (I've tried adding the ignore/execute config to fix it, but it never works properly), so I've switched to Spring Tool Suite, which claims to have full Groovy support. How should I set it all up? So far I've had exactly the same experience as with regular Eclipse, but given that SpringSource are responsible for Groovy, I figure there must be a way of doing it.
Have you read this thread?
http://forum.springsource.org/showthread.php?130130-Working-with-Mavenized-Grails-projects-in-GGTS-3-1-0-Updated-for-3-1-0-release/page2
For grails projects, you do not need to use gmaven or the groovy-eclipse-compiler. You must be using the 3.1.0 STS (which is not actually released yet, but you can get this
You also must be using Grails 2.1.1.
You can secretly get a 3.1.0 release build by going to this download page:
http://www.springsource.org/downloads/sts-ggts
Instead of clicking on the links, copy them and substitute 3.1.0 for 3.0.0.