Specifying a package name in gradle for your library?


(Tom Esposito) #1

Hello, I am new to gradle and wanted to build a simple library to use in another simple project. I wanted to try out a java environment beyond eclipse, so I am using vscode for my editor and gradle for building and managing dependencies. So far so good for importing libraries and local jars, but I can’t seem to google around and figure out how my library itself can be used.

The only thing I know is that the jar is called “lib.jar” and the class is called “SomeLib”. I built this jar and saw only the SomeLib.class file inside it and practically nothing in the manifest. I was following gradle’s guide for creating a java library, but I believe I may have missed something. In my other project, what do I import to use this library? It’s included in my runtime fileTree thing in dependencies (if there is a better way to do that, let me know as well, thanks!) but I don’t know how to set my package name.

Eclipse usually did everything for me but I’d like to move to a lighter environment. Thanks for any suggestions!

–edit: It looks like eclipse crippled my basic java skills more than I realized, haha. I have yet to test & get it working myself, but the one thing I have not tried is to properly setup the directories. I also thought there might be some extra work needed since I’m using gradle now, but it looks like that may not be the case.