Home > Mobile >  How to reference to packages from Maven local repository?
How to reference to packages from Maven local repository?

Time:02-08

In my project I need to reference to the package installed by Maven to local repository. I've added the dependency to pom.xml, but the project doesn't want to build as it wouldn't even see the package. Here's the pom.xml fragment with dependencies:

<dependencies>
  ...
  <dependency>
    <groupId>libraryweb</groupId>
    <artifactId>classes</artifactId>
    <version>1.0SNAPSHOT</version>
  </dependency>
</dependencies>

When I try to import the package "libraryweb" I get

Cannot resolve symbol 'libraryweb'

error. What can I do to use the package?

Edit: Intellij prompts me classes from the package when I try to use them, but I still get "cannot resolve symbol" error.

CodePudding user response:

Note that groupIds and package names are not necessarily the same.

So while your JAR is installed under a certain groupId, artifactId and version, the actual package that you need to import in your Java code may have a different name.

In doubt, unpack the JAR and look at the directory structure.

CodePudding user response:

I solved the problem by linking the .jar file with IntelliJ projects settings instead of using Maven to do it.

  •  Tags:  
  • Related