Get dependency source code with gradle - gradle

Is there a way to get the sourcecode of a dependency using gradle.
I've found that using the eclipse or the idea plugin may work but I want to keep my code IDE agnostic. Is there a way to obtain the source code for a given dependency? and/or using the eclipse or idea plugin would require me to have those IDE's installed to work?

I noticed this was solved since Gradle 2.0, the source in my case is in:
~/.gradle/caches/modules-2/files-2.1/

Related

IntelliJ IDEA on Mac. Is it possible to build my Kotlin Native project from the commandline without the IDE?

Quite new to all things Kotlin / IntelliJ / IDEA / gradle.
I'm comparing some code in about ten languages and the Kotlin Native version is the only one that I can't figure out how to build without using the IDE.
I started the project in IntelliJ IDEA by following guides on getting started with Kotlin and this was the recommended method.
By Googling, searching the IntelliJ help, and hunting here on StackOverflow I've been unable to find the answer. Most questions are about Multiplatform and phone apps. I'm just making a macOS commandline tool for now.
Is there a way included with IntelliJ IDEA to build a project form the terminal without starting up the IDE?
Or would it actually require me to use a completely different build system and just use Kotlin Native Mono install totally separate from the IntelliJ setup? Is no shared build system possible or would that be an even more advanced proposition?
There is no need to use the IntelliJ IDEA to build the Kotlin native project.
You should be able to use the gradle build or gradle nativeBinaries command from the Terminal to build the Gradle project.
Also, you could refer to the Kotlin native documentation here for details: https://kotlinlang.org/docs/native-gradle.html
I figured it out with a bit more trial and error.
IntelliJ IDEA seems to come with gradle but doesn't put it in the path. The IntelliJ IDEA project has set up a build system that will work with gradle as is though. You don't have to set up a new one from scratch.
In my case the gradle executable was at:
/System/Volumes/Data/Users/hippietrail/.gradle/wrapper/dists/gradle-7.4.2-bin/48ivgl02cpt2ed3fh9dbalvx8/gradle-7.4.2/bin/gradle
Running gradle using the full path with no parameters looks like it's doing something and takes a while, but doesn't build the project. To build it simply add the build parameter so in my case:
/System/Volumes/Data/Users/hippietrail/.gradle/wrapper/dists/gradle-7.4.2-bin/48ivgl02cpt2ed3fh9dbalvx8/gradle-7.4.2/bin/gradle build
It seems that gradle is not in the path by design and that the intended usage is via the gradlew that IntelliJ IDEA put in my project directory for me. This is an (explicit) wrapper script for gradle. So the more straightforward invocation is:
./gradlew build

How to Use JAXB with Java 11 Without Using Maven

As of Java 11 it is necessary to get JAXB from a separate library, not from the JDK. There are plenty of tutorials on the Web showing how to do that, but they all use Maven. The project I need to fix is an Eclipse RCP application. There does not seem to be an easy to make that work with Maven, as Maven essentially takes over most of what Eclipse would do but doesn't have RCP development capabilities.
Sooner or later Maven gets the required libraries. I would like to find another way to get and use whatever libraries are needed, just without using Maven. It should be possible. I just haven't found it.
Thanks.
I did what I wanted by downloading the needed JARs from https://mvnrepository.com/.

Gradle equivalent for Maven Java formatter that uses com.googlecode.maven-java-formatter-plugin

I'm switching a large project from Maven to Gradle. Existing Maven project uses com.googlecode.maven-java-formatter-plugin to format the Java code. Looked for the equivalent in Gradle. Found https://plugins.gradle.org/plugin/com.github.sherter.google-java-format, but it spewed a bunch of errors out, was really slow, and didn't generate the same output as the Maven plugin.
Also looked here: https://github.com/google/google-java-format - no help.
Is there a Gradle plugin which will give me same result as the Maven plugin?
There is this other Gradle plugin, which uses the Eclipse formatter. Maybe you can tweak it to achieve the same results as with the maven plugin you mentioned (I'm not using this plugin myself).
Note that it is an explicit non-goal of google-java-format and the corresponding Gradle plugin to be configurable. If you are not happy with the formatting style then this tool is probably not appropriate for you.
(if you have technical problems with my Gradle plugin, feel free to provide more details or open a ticket on Github)

Which versions are required to get a working Acceleo Maven build

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.

How should I set up a Maven/Groovy project in STS?

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.

Resources