Help getting started with extension development

Friends, I have set up the environment, installed Rush, created a test project and compiled the accompanying example. Everything is working.
Now you need help with some things that are not very well understood by me.
I intend to use UniREST to connect to, so I downloaded “unirest_3_11_11.jar” and put it in the deps folder of my project, modified “rush.yml” leaving the last lines like this:
. # Dependencies declared here should be present in the “deps” directory.
. deps:
. - unirest_3_11_11.jar

Is “-” required before .jar file?
Now how should I import “unirest_3_11_11.jar” into my project?

just add import command in your code and add your package name

import unirest_3_11_11.jar

or this:
import com.laboratoriodosfundos.supabase

import the classes of the library.

i guess this

Do you develop extension with Rush or the old fashioned way with Ant?

As per i understood u need to import jar to rush.

So as the solution

add your .jar to deps folder and after that in rush.yml you will get this line at last

# Dependencies declared here should be present in the "deps" directory.

# deps:

#   - my_awesome_library.jar

you have to remove the #

# Dependencies declared here should be present in the "deps" directory.


   - my_awesome_library.jar

it is necessary to add - before the jar.

Okay, that much is understood and has been done. The question is, is it necessary to import this into the project and how?

Yes if u want to use the external imports you have to do these things

1 Like

Sorry, is that really quite old fashioned?


If it is , then I love Old-Fashioned :sweat_smile: :grin: :grin:


I still use it and love it, its good too :sweat_smile::blush:


Put the downloaded JAR file in the deeps directory.
Edit the rush.yml file adding your dependencies

  - beanshell.jar

Make sure there are no extra lines below.
Now the dependency will be compiled along with the extension.

Just to import to the project (or let IDE index the JAR), you have to right-click on it, then select “Add As library” if you are using IntelliJ IDEA.

Then you will be able to normally import packages (for the code editor).


Of course not, just a figure of speech.

I’m using VSCode, as there is no such facility here I ask.
The import of the library is like this?
import com.laboratoriodosfundos.supabase

This is no longer required and IntelliJ IDEA (or any other JetBrains IDE) should be able to automatically index dependencies for every extension created using Rush 1.1.1 or higher.


So after editing the rush.yml file you don’t need to do anything else to import the library?

Nope, I didn’t mean that. Just like every other Java/Kotlin program, importing necessary external classes is required for extensions as well.


And how this is done,
by giving the file name, package name?
Can you give me an example?

This is basic … Did you really have tried writing simple programs in java ??

To import java package into a class , we need to use java import keyword which is used to access package and its classes into the java program. Use import to access built-in and user-defined packages into your java source file so that your class can refer to a class that is in another package by directly using its name.