Unable to debug a gradle plugin - gradle

I have developed a Gradle plugin. Since the latest upgrade of gradle, that plugin is failing, and I need to debug the plugin in order to find out what exactly is going wrong. I am, however, unable to debug the plugin.
I'm doing the following:
I set the following environment parameters: GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
I execute the build running the plugin from the commandline
I attach my IntelliJ debugger to the running process.
This immediately fails however with a ClassNotFoundException in IntelliJ: org.gradle.launcher.GradleMain.
The plugin should work with all gradle versions. The plugin itself has following gradle relevant dependencies:
<dependency>
<scope>provided</scope>
<groupId>org.gradle</groupId>
<artifactId>gradle-core</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<scope>provided</scope>
<groupId>org.gradle</groupId>
<artifactId>gradle-plugins</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<scope>provided</scope>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId>
<version>1.12</version>
</dependency>
I have tried adding following dependency as well:
<dependency>
<scope>provided</scope>
<groupId>org.gradle</groupId>
<artifactId>gradle-wrapper</artifactId>
<version>4.5.1</version>
</dependency>
But that doesn't make any difference.
The difficulty here is that the plugin should work with all Gradle versions (version 1.12 up to 4.5). That is the reason why the plugin itself depends on old versions of Gradle at compile time. Where the different versions of Gradle differ, I currently resort to reflection to achieve my goal at runtime.
While Gradle 1.12 is in the dependencies of the project, the build being debugged uses Gradle 4.5.1. However, even if I switch the gradle version of the project being debugged, the same error remains. Also, as the plugin works fine on all versions prior to 4.5, such a debug session wouldn't help alot even if I would get it working.
Any ideas on how I can get the debugger to debug the plugin?

Related

Unable to resolve javax.annotation.Priority dependency issue in maven project

I'm starting a Jersey, Springboot project with swagger integration but I'm having issues resolving the javax.annotation.Priority dependency. I came across
this link and I have experimented with adding the suggested modules and also added
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</dependency>
but so far nothing resolves this issue for me.
I'm working on MacOS and compiling in Java 10.

Vaadin grid-renderers-collection-addon breaks compilation of widgetset

I added grid-renderers-collection-addon to my pom.xml in a maven project:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>grid-renderers-collection-addon</artifactId>
<version>0.94</version>
</dependency>
Now everything is broken, even if I remove the addon from pom.xml again.
I get the message:
Failed to load the widgetset: ./../../VAADIN/widgetsets/AppWidgetset/AppWidgetset.nocache.js?1519127577157
I really want to use the addon, but I don't even know which is the latest version. I looked at solutions that involved having a ProjectWidgetSet.gwt.xml file, but I don't know where to get this file from.
vaadin.version is 8.1.1 not sure the addon is matching this version
I fixed the error by commenting out an important artifact in pom.xml, launching the service (aborting because of errors), then adding the artifact again.
It was this artifact:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
</dependency>

How to include custom type converter using Maven and Grails

I am working on a Grails project that needs to compile with both Grails and Maven. Everything worked great except for my GSON converter I added (using the grails-gson plugin). Now I get the following when I run mvn install.
unable to resolve class grails.plugin.gson.converters.GSON
Anyone know how to overcome this
Plugin has to be added as a dependency in pom.xml too
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>gson</artifactId>
<version>1.1.4</version>
<type>zip</type>
</dependency>
Mavenized grails project refer pom file for all dependencies (including plugin dependencies).

downloading guice3.0 artifact from maven central repository

I'm trying to upgrade my struts2 web app from guice2.0 to guice3.0.
I'm trying to test it out using maven jetty.
I've successfully upgraded my pom.xml to use the correct version and groupId for the 3.0 release, but if I call mvn jetty:run
I see that it is trying to download
guice-3.0-no_deps.jar
which throws a build error and can't be found the central repository?
I don't get this error if I don't include any guice extensions.
Any ideas?
Thanks
I posted this question also to the guice user group.
This is the answer I received.
The guice-3.0-no_deps.jar is a build-time artifact that's used to compile the extensions, but is not required at runtime - it's not on maven central because the Guice team didn't want people depending on this "uber-jar" by mistake. The extensions have an optional dependency to guice-3.0-no_deps.jar (so they can compile) but they also have a non-optional dependency to guice-3.0.jar for the runtime case.
Well-behaved maven plugins should see that the the no_deps dependency is optional and not throw a build error if it's missing, so this sounds like a bug in the jetty plugin. To workaround the Jetty bug you can explicitly hide this dependency as follows:
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-struts2</artifactId>
<version>3.0</version>
<exclusions>
<exclusion>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
Note that we can't do this in the original build pom because we still need the no_deps dependency when doing the original compilation.

Choosing dependency version in maven and maven plugin

I have a maven plugin which is using hsqldb 1.8.0.10. In my pom.xml from the plugin, it is declared like this:
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
</dependency>
But if I run that plugin from another maven project, and that project has a newer version of hsqldb (for instance 1.9.0), how can I configure my plugin that he will use the newest version of hsqldb, without changing it's pom.xml?
And is it possible to do this the other way around as well? If my other maven project uses hsqldb 1.7.0 (for instance), that he will use the 1.8.0.10 version which is specified in the maven plugin itself?
I hope someone can answer my question.
Kind regards,
Walle
Your main question is possible, but it might not work properly if the plugin doesn't work with the newer code for any reason.
A plugin can have it's own personal dependencies section, and will use standard Maven dependency resolution, choosing the highest version requested. So, you can do
<plugin>
<groupId>some.group.id</groupId>
<artifactId>some.artifact.id</artifactId>
<version>someversion</version>
<dependencies>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.9.0</version>
</dependency>
</dependencies>
</plugin>
I don't think going the other way around is possible, though.
use properties place holder for the version, say ${hsqldb.version} then declare in different project pom the version you want to put in it

Resources