Adding a library to a netbeans gradle project

I decided to try using libgdx for graphics. However, gradle is used to manage the package; However, I have very little experience with gradle.

My question is if I have a library (.jar file) of my code. Usually in netbeans I can right-click on “libraries” and select “add jar / folder”, and it adds the library to my ant file, and, more importantly, ide now recognizes .jar and provides it with autocompletion, etc. .

In gradle, I got a file that should appear in the dependency branch, putting the following in the assembly:

dependencies {runtime fileTree (dir: 'libs', include: '* .jar')}

However, libraries will not import, and the ideal does not recognize their existence. The (absurdly large) online documentation for gradle seems to only want to deal with repositories, and I cannot find documentation for netbeans gradle. Any help would be greatly appreciated.

+4
source share
1 answer

This also puzzled me a bit ...

First manually add the dependency to your build.gradle script. Like your example:

dependencies {
   runtime fileTree(dir: 'libs', include: '*.jar')
}

Then, in the Netbeans Projects sidebar, right-click the project name and select "Update Project" from the context menu.

Then your dependencies will be displayed in the Dependencies folder of the project and code completion, checking for compilation errors, etc., as usual.

"", → Ctrl + 1.

+1

Source: https://habr.com/ru/post/1613981/


All Articles