Gradle rooky stucks during switching a project to gradle and need help

Hi guys

I have a little software project, originally made with netbeans native ant, and now the time is come where I get help from other people and want to switch to gradle. I tried some weeks with tutorials and reading documentation, but I stuck during setup and have no idea how I can continue without help. And sorry, software development is not my main profession and so I’m not familiar with all tools like maven or gradle. I have no idea about both, but want to get some knowledge about gradle at least.

This project includes an other library and an annotation processor, both are local projects here and I want to include them as subprojects. I think this would be the native way for library projects.
For the first shot, I don’t care about versioning of these library projects, maybe I will do this later. All of these projects are versionised by SVN, but these gradle project should be versionised with git.

What I want to do is:
-Look for a directory, which exists local here. If it exists, grab and import its source files. This should ensure to get the latest code version. I was told that this is not the golden way and I think about a better way, but for now I have no idea how to do it better. Maybe I will have with more gradle experience.

-Setting all dependencies. This is most important actually and this is also where I stuck and why I’m here. Setting the library (its called EngineeringUtils) as dependency was hard, but works after including the whole file tree. I think better would be to include only the build artifact (the build of this library itself works fine by gradle), but I was not able to achieve this. If anyone can show me where what I did wrong, please tell me.
The next is, to set the annotation processor (its called ForceDeclaredGenerics). I get always a message about bad declaration string or gradle could not find the files and please for advise to fix this.

If I get the issues above fixed, I expect some errors about missing dependencies (at least mXparser and objenesis I remember actually), but this is the next step.
In sum, I would like to get the gradle project in a state, where I can have all dependencies local and update them if neccessary in that way, that an internet connection (e.g. maven repositories) is not neccessary for every run and I can share the project offline.

I hope anyone can help me.

You may find the misterious project I’m talkting about here:

best regards

From a very quick look, you should have a look at composite builds: Composing builds
Your EngineeringUtils and ForceDeclaredGenerics are full own builds (having a settings script), so you should not include it somewhere as subproject, but include the whole build using composite builds.

Thanks, the informations about composite builds makes some things more clearer to me, but I still have questions.

If I start a powershell in …/jCLS/jComponent Library Sorcerer/ and call gradle with “gradle --include-build build” as in the docu, gradle returns with “build succesfull” in this way:

> gradle --include-build build

> Task :jComponent Library Sorcerer:help

Welcome to Gradle 7.5.1.

To run a build, run gradle <task> ...

To see a list of available tasks, run gradle tasks

To see more detail about a task, run gradle help --task <task>

To see a list of command-line options, run gradle --help

For more detail on using Gradle, see

For troubleshooting, visit

10 actionable tasks: 1 executed, 9 up-to-date

But I would expect an error about missing JavaFX and mXparser libraries, because did not declared this dependencies to gradle but using them. And I miss the list what gradle has build, as in the example output.

Nethertheless, I added changed the jCLS/settings.gradle into this: = 'jComponent Library Sorcerer'

includeBuild 'EngineeringUtils'
includeBuild 'ForceDeclaredGenerics'

include('jComponent Library Sorcerer')

After reading the documentation about composite builds, I would expect that “gradle build” call should work now (in the same way above), but gradle states again that it could not find the annotation processor. I think there is no wonder why, because I forgot the run-task-dependency-declaration. But I’m wondering about the different output.

For this declaration, I’m wondering what I have to do in the end of the two lines. Both are libraries, I guess ‘:app:run’ is senseless, right?

tasks.register('run') {
    dependsOn gradle.includedBuild('EngineeringUtils').task('?')
	dependsOn gradle.includedBuild('ForceDeclaredGenerics').task(':?')

gradle --include-build build means “include the build at directory ‘build’ and run the default task of this build”, which by default is the help task, so you just execute the help task and nothing is built at all.

Besides that, you should never use gradle, but always gradlew to use the Gradle version the build you are currently executing is designed for. An installed Gradle version usually is never necessary at all.

gradle states again that it could not find the annotation processor

It states it doesn’t find it because it doesn’t exist. Probably because you accidentally named your folder wrong. ForceDeclaredGenerics/settings.gradle does an include for project ForceDeclaredGenericsProcessor, so without further configuration would expect it at the directory ForceDeclaredGenericsProcessor/, but there is only ForceDeclaredGenerics.

tasks.register('run') {
   dependsOn gradle.includedBuild('EngineeringUtils').task('?')
   dependsOn gradle.includedBuild('ForceDeclaredGenerics').task(':?')

No, this does not make any sense.
Basically any dependsOn you write is wrong, you should practically never need an explicit one.
(with the exception of a lifecycle task on the left-hand side where it is ok and expected).

Well, I installed gradle new some weeks ago and put initialized all gradle projects and subprojects at the same day. As told, I have never worked with gradle before, and these projects are not gradle projects before.

You was right with the wrong naming, I put wrongly the classname in. After editing the settings.gradle, the message do not pop up (but other fault message do).

After this, I get this:

  • What went wrong:
    Plugin [id: ‘’] was not found in any of the following sources:
  • Gradle Core Plugins (plugin is not in ‘org.gradle’ namespace)
  • Included Builds (None of the included builds contain this plugin)
  • Plugin Repositories (plugin dependency must include a version number for this source)

I have no idea what this plugin do, it seems to me I have to read more docu about it. I assmue that gradle itself put it in. I used the gradle init-command for every project and subproject.
Or do you have some quick hints for me?

Thanks for your gentle advise.

You generated a project with convention plugins in buildSrc.
One of these is the which is meant to be applied to all projects in that build that are Java applications, so that all get the same configuration and settings in a clean way.
This convention plugin is applied to your root build’s root project build script.
And here this also works, although there are then quite some other errors.
So you probably have a different state now than what you showed.

Well, it’s possible that the version in the first post is out of date now. I wanted to attach a new version in my seccond post, but all I got was a message, that newbies can’t upload files.

I updated the source forge link: jCLS - Browse Files at

You deleted the buildSrc build that contained that convention plugin it tries to apply.
So now it is of course not found anymore. :slight_smile:


Ok, I put the buildSrc folder back and updated the project here:

I renamed all unity to “ForceDeclaredGenerics”, but gradle stills not find the annotation processor. Ofcourse I checked also for mistyping, but didn’t found any. Any other ideas?

annotationProcessor ‘ForceDeclaredGenericsProcessor:de.oliverlenz.forcegenerics*’

That’s not at all a valid dependency declaration.
Or well, it would search for a dependency with group ForceDeclaredGenericsProcessor and artifact name de.oliverlenz.forcegenerics*, not specifying a version.
And that does not exist.

If you run the task :ForceDeclaredGenerics:ForceDeclaredGenerics:outgoingVariants you see that what this project generates has the coordinates ForceDeclaredGenerics:ForceDeclaredGenerics, so the annotation processor dependency would be

annotationProcessor ‘ForceDeclaredGenerics:ForceDeclaredGenerics’

If you fixed, that you will get the next error because RowModel does not find ForceDeclaredGenerics which has two reasons.

  1. the package is wrong, it is de.oliverlenz.forcedeclaredgenerics.ForceDeclaredGenerics, not de.oliverlenz.forcegenerics.ForceDeclaredGenerics.
  2. the classes in ForceDeclaredGenerics are in src/main but the default location is src/main/java and you did not configure a non-default location, so you either have to move the classes to the proper place or configure the correct source directory. (former is preferable)

After fixing that, I got complaint about non-existing SourceVersion.RELEASE_16 as I used Java 11 to run the build, so you should probably use the “JVM Toolchains” feature to decouple the version needed to build your code from the version used to run Gradle.

After that a couple more instances where the import has the wrong package.

Then it complains about not finding the commons-csv classes which you did not add as dependency.

Then the same for org.mariuszgromada.math.mxparser....

I’ll let the remaining exercise for you. :wink:

Yes…thats sounds good, I expected some errors about missing libraries, I tried first to get gradle project configuration right.

I renamed the package names, and after that, gradle returns with a big bunch of compiler errors. I added the missing library files into a new folder, and added the whole folder as file tree to the dependencies. (I think I will want to have a better solution for it, but for the first shot its ok to get it working.) I think it works now, I get less compiler errors. It was 100 errors before, and 13 errors remains now.

These 13 errors seems refering to the two library projects, EngineeringUtils and the ForceDeclaredGenercis AnnotationProcessor, but I wonder why. If I understood
right, a line “implementation project(‘:EngineeringUtils’)” in the dependency section should do it, but it doesn’t help. Is the declaration wrong?

I updated the project file under Download jCLS from

Project dependencies are to depend on projects within the same build. If you want to depend on an artifact in another build (including one your included as composite build), you have to declare a normal dependency using the coordinates, not a project dependency.

Coordinates…do you mean the relative path to the project?

Something like implementation fileTree(dir: '../EngineeringUtils/EngineeringUtils', include: '*.jar') or several variations does not work, or did I understand you wrong?

If I would have meant relative path, I would have said that. :wink:
I meant what I said.
Artifact coordinates.
Like for any other dependency that is not part of the same build, like org.apache.logging:log4j-core.
The group and project name you configured for that project.
You can also use the outgoingVariants task on the EngineeringUtils project to see them.

Oh…I mistook these sample strings like org.apache. … for classpaths. To your post before, I feed duckduckgo with a quick search for gradle relating dependency coordinates, but all I get was docu or discussions to plugin-relating stuff.
Is there any documentation about this?

Hell, JavaFX was a big bunch of work, but domesting gradle was the hardest until here.

Hell, JavaFX was a big bunch of work, but domesting gradle was the hardest until here.

Well, that’s probably because you try to run before you learned to walk, trying to build a complex multi-project multi-build thing with annotation processing and what-not without taking first steps first. :smiley:

To your post before, I feed duckduckgo with a quick search for gradle relating dependency coordinates, but all I get was docu or discussions to plugin-relating stuff.
Is there any documentation about this?

I’m not sure what you are asking about, or what docu you want.
Maybe this one: Declaring dependencies

Well, that’s probably because you try to run before you learned to walk,

Yep…you are likely right. But I work normally on the hardware side of modern technology. I like programming and think I have some talent for it, but I would never say that I’m a programmer. To get everything perfect is impossible today, and on the other side we really suffer from bad running cripple ware and bad solutions and I do not want to add something to that.
So, any compromise is inevitable, and I’m very glad about forums like this and guys like you. :wink:

I’m not sure what you are asking about, or what docu you want.
Maybe this one: Declaring dependencies

I want to know how to write these coordinates in a format which gradle will accept. As I told, I mistook them as a classpath before. I know the declaring dependencies page and did not found there what I want to know. There are many examples with code, but no example project directory structure or something similiar to compare, so I have no idea about lines like org.apache.commons-lang mean. I know the commons-lang-library from Apache, but how does gradle know them? At first, I assumed that gradle is able to crawl the source code files (gradle needs to know the language and specifies source code location in an unmistakable way and the groovy script tutorial files even in many real projects looks very short), but now I think this would be dreamed to much.

Or in short: I have absolutely no idea how to write such coordinates and no idea how to become more shrewd about, and want to know where I can fix this lack of knowledge.

Grmpf…I posted yesterday something about shitty software, relating to running before able to walking. Here, we have a great example for this, the dammed ‘Akismet’ halluzinated my post as spam, after I corrected the quotation and did an edit.
And now, my post waits for a moderator waking up from christmas boose to check for spam.

Anyway, I want to know how I have to write such project coordinates. As I wrote, I mistook the documentation examples as classpaths. I know the link about dependency declaring, but I still having no idea about how I have to write the coordinates for my own project structure.

Sorry, your post from yesterday got caught up in the spam filter and was pending approval. Clearly wasn’t spam and I just approved it.

1 Like

Happy new year everyone :slight_smile:

During stucking with these coordinate annotations, I started another try as interim solution, until I get the gradle settings right. The plan was to include the build artifacts of EngineeringUtils and ForceDeclaredGenerics into the libs folder, where all other external libraries are.

So added a new task to the EngineeringUtils project to copy from the project build folder into the libs folder, and attach it to the build task. The task works fine, everytime the EngineeringUtils project build task starts, the new jar file is in the libs folder.

But a build tasks in the main project stills missing the library. I get the same 13 errors before, but expected some errors to fade out. E.g. the errors with missing label “ESeries”, this label refers to the EngineeringUtils library.

Whats wrong on my idea?