0

I am trying to package a SpringBoot project of mine to use as a library in another. I had it working somewhat but not I can't get my library classes to resolve at all.

I don't get any errors to do with the dependency in my POM file. I simply can't get to my library in my code.

I am building my package then installing it in my local Maven repo with mvn install:install-file -Dfile=myPackage.jar When I navigate to my local repo, the package is there and the pom file looks right. I bring it in to my project with

    <dependency>
        <groupId>com.mygroup</groupId>
        <artifactId>mylib</artifactId>
        <version>0.0.1</version>
    </dependency>

which all matches the POM for the package in the maven repo. I update the project configuration and no issues are found in my project POM. But com.mygroup.mylib is simply not found.

It seems that Maven is finding the dependency but for some reason the classes can't be found within it.

What are some ways to get more information about where the disconnect is?

I am using spring boot 2.0.0 and VSCode 1.20.1.

Stoopkid
  • 1,885
  • 2
  • 17
  • 30
  • Your class package declaration is com.mygroup.my-lib? Can you confirm it. – Midhun Mar 07 '18 at 19:50
  • @Midhun for the sake of simplicity I tried with everything having the dashes removed and repackaged and installed into maven and I get the same issue. – Stoopkid Mar 07 '18 at 21:12
  • https://stackoverflow.com/a/42487587/2480560 This answer solved it for me. I voted to flag as duplicate. – Stoopkid Mar 07 '18 at 21:32
  • Using `mvn install:install-file` for a Maven project does not make sense...just use `mvn install ` in your project to install in your local cache...furthermore a link to your project on github would be helpful and much more a full log output and a full pom file... – khmarbaise Mar 07 '18 at 22:58

1 Answers1

0

Run maven command for logs to find out actual issue.

mvn clean install -X

Mujahid Masood
  • 111
  • 2
  • 8
  • What am I looking for? Everything looks normal until I try to include it and I simply get a "cannot find symbol" error for `mylib` – Stoopkid Mar 07 '18 at 21:15