4

I followed this gradle tutorial:

https://guides.gradle.org/building-java-libraries/

with gradle 4.9 and for some reason in projects that reference the build jar can't see the Library class that should be created and be accessible once the project is built. I've changed nothing about the build settings and what not. Only run gradlew build from the command line to build the project.

I've tried finding the package path in my project, I've tried using eclipse to auto discover the import, it never finds it. (Note that the default method that the java-library type creates I've changed to static for my tests)

Am I missing something, I'm very new to Gradle and I'm trying to expose myself to it. But I'm familiar with just exporting a straight jar from the export window in Eclipse. So I can't quite determine what I'm doing wrong. Project Structure:

Gradle project

build.gradle file:

enter image description here

2
  • 1
    Can you please share your build.gradle and your project structure? Commented Aug 16, 2018 at 2:38
  • Please provide a minimal reproducible example that reproduces the problem you are asking about. Commented Aug 16, 2018 at 2:47

1 Answer 1

2

As per the gradle tutorial which you mentioned above, you first run the gradle init command which initializes the project by creating the project hierarchy for you as per the type. Your type is java-library.

Now run the gradle buildcommand. Build is also a implicit task which when executed creates the artifact(jar) for you under building-java-libraries\build\libs directory.

Please note that I was not able to see the build directory in eclipse but I could see the same in my eclipse workspace.

Sign up to request clarification or add additional context in comments.

1 Comment

It is not the eclipse portion that is the issue, I'm building from the command line, and trying to include the Jar in an eclipse project just to make sure that the build is working correctly and I can access the library inside.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.