1

In my Maven project, I need to use a particular class (specifically, org.eclipse.rdf4j.model.util.Values.bnode) However, when I import it in Eclipse it logically complains it couldnt find it. Further, when I look for the Maven repo of rdf4j in https://mvnrepository.com/, I find a bunch of them and I dont know which one contains the class I am looking for.

So my question is : is there a simple way to look for the Maven repository that contains a certain class or package?

Thx in advance

BTW. I found this class in an online tutorial. But the turorial does not give the maven configuration or the package information, which is not convenient at all. Tutos should always mention how to set the environment and import specific packages (or at least point to another webpage that does).

Abdelghani
  • 455
  • 2
  • 9
  • 19
  • 2
    I don't believe there is a way to do exactly what you want (which is unfortunate in itself), but I would strongly recommend using the official Maven central package search, which does have some namespace-based searching -- https://central.sonatype.com/search?smo=true&q=rdf4j ; based on James' comment below I was able to find the source repository underlying the main rdf4j eclipse package, which is what I think you're looking for: https://github.com/eclipse/rdf4j/blob/main/core/model/src/main/java/org/eclipse/rdf4j/model/util/Values.java – Byron Lagrone May 24 '23 at 11:17
  • Most IDE'S automatically search for the missing dependencies, if needed. Maybe turn on auto complete in your editor. – Peter Mulm May 24 '23 at 12:03
  • Thanks @Byron Lagrone and James Baxter. I am probably missing something because I have looked in the git repo and used the version in the pom file but still cant see the class I am looking for. – Abdelghani May 30 '23 at 07:19
  • @Abdelghani interested to hear which tutorial you were looking at. If it's one by the RDF4J project, perhaps I can fix it. – Jeen Broekstra Jun 01 '23 at 08:59

2 Answers2

2

Personally I try to find the source repo for the project that contains the class, then I look at the maven configuration (ie pom.xml) to see what groupId/artifactId it's published under.

Sometimes you will need to look at older git tags if the class has moved and/or been deleted.

James Baxter
  • 1,237
  • 9
  • 17
0

Looking at the specific project website is usually a good idea if somehow these dependencies are not automatically found.

In this case, the RDF4J project gives instructions on how to get the right maven artifacts on its download page. You can also look in the Github repo, if you search for the class file (Values.java in this case) you can see what package and module it's in: it's in the rdf4j/core/model directory, which has a module POM that gives you the details of the specific maven artifact:

    <groupId>org.eclipse.rdf4j</groupId>
    <artifactId>rdf4j-model</artifactId>
Jeen Broekstra
  • 21,642
  • 4
  • 51
  • 73