1

I am building a custom Java library. I keep most of my "repeated" codes there, like file handling, string processing, etc. Each time I want to use them, I have to copy and paste the class into the other project(s) I'm on. Is there a way I can make this custom library class into a "dependency"? I'm using IntelliJ as my IDE.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
NightStorm
  • 101
  • 12
  • You should take a look to [this](https://stackoverflow.com/questions/31342689/how-do-i-use-classes-from-another-project-in-intellij-idea). – Filippo Dec 21 '21 at 18:21
  • yes i did @Filippo but I dont understand what this means: "Never use project class in another project, always create a nice interface and use that interface in other projects". and how to do it – NightStorm Dec 21 '21 at 18:22
  • See https://www.jetbrains.com/help/idea/working-with-module-dependencies.html#add-a-new-dependency. – CrazyCoder Dec 21 '21 at 18:24
  • Check also [this](https://www.oracle.com/corporate/features/library-in-java-best-practices.html) – Filippo Dec 21 '21 at 18:28

1 Answers1

2

you can add the master project as a jar (dependency) to your projects.

evren
  • 130
  • 5