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.
Asked
Active
Viewed 434 times
1
-
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 Answers
2
you can add the master project as a jar (dependency) to your projects.

evren
- 130
- 5
-
-
You can check this thread, https://stackoverflow.com/questions/1051640/correct-way-to-add-external-jars-lib-jar-to-an-intellij-idea-project – evren Dec 21 '21 at 18:35
-
-
1