Holland
Holland

Reputation: 415

Maven-related Java build error: pom.xml is missing

I'm just starting out with Maven, in NetBeans. And I'm trying to figure out why I'm getting the following error message upon building the project (a Java Web Application):

The POM for unknown.binary:hibernate-jpamodelgen-4.3.1.Final:jar:SNAPSHOT is missing, no dependency information available

In the following screen print, you can see the error message, but you can also see that this dependency IS in fact present in pom.xml, and that the relevant .jar-file IS in fact present in the Dependencies folder (all relevant parts marked with a thin red line in the screen print, and you can click on the image to enlarge it):

EDIT: In the screen print, I marked the wrong .jar-file in the Dependencies folder red, it should be the one immediately below the one I wrongly marked.

enter image description here

So I'm wondering what I'm missing here...

EDIT: In the screen print, I marked the wrong .jar-file in the Dependencies folder red, it should be the one immediately below the one I wrongly marked.

Upvotes: 1

Views: 7229

Answers (2)

D-unit
D-unit

Reputation: 146

That dependency looks wrong

Are you compiling that jar in the project?

Change it to:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-jpamodelgen</artifactId>
  <version>5.2.6.Final</version>
  <scope>provided</scope>
</dependency>

Or whatever version you want to use (that is the version running in your container, e.g. tomcat)

Upvotes: 2

Dakoda
Dakoda

Reputation: 175

In order to run, you need all jar files. A lot of dependencies need associated jar files too. Consider the target "dependency:tree". It shows ALL the dependencies for your project, including the ones you've declared as dependencies. (I'll get back to this later)

When you include a dependency, maven needs to know if THAT dependency has dependencies so it can pull in those jars too. Maven goes out and pulls in the jars, storing them in your $M2_HOME directory. It also includes an associated pom. You can find this on maven's repository https://mvnrepository.com/. That page will show also show you how to declare your dependencies in YOUR pom. Really good site.

Go to your home directory and look for ".m2"\repository. Then traverse down using your jar name and do a dir command. it will show the jar and associated pom. That pom is needed for it's (jar file) dependencies.

when you do a dependency:tree target, it will search through all the poms, including those in the $M2_HOME directories and display a tree showing all the dependencies. Your's is missing the pom

I just went to maven's site and put in your artifact name. Here's the pom dependency it said to use.

  <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-jpamodelgen -->
      <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-jpamodelgen</artifactId>
      <version>5.2.6.Final</version>
  </dependency>

Upvotes: 0

Related Questions