How to create my jar file correctly and add it to Maven?

lpopek March 5, 2019

I have class that contains all functions that are repeating themself through current plugins written by me. I want to extract this class and use it as dependencies (jar) in my projects. 
I tried many tutorials from JetBrains and I still cant use It as dependency jar in my plugins. Can you help me with this? Where can I find the correct documentation?

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2019

Hello,

You need to create a separate project for your library. Pack it with maven, gradle or any way you want it to be packed, and then use the jar file as dependency in your other project.

In your other project you can reference your library in two ways:

1. You can put your jar file in artifactory, nexus or something like this and reference it

2. You can store the jar in the file system and reference it from this folder.

lpopek March 6, 2019

Would you describe in more details second point?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2019

Suggest an answer

Log in or Sign up to answer