#Include Hibernate dependency with Maven

6 messages · Page 1 of 1 (latest)

small sky
#

Hello, making my first steps with maven and hibernate here and I can't even succesfully compile my program. I have a pom including the following dependencies:

org.glassfish:jakarta.el:3.0.3
org.hibernate.validator:hibernate-validator-annotation-processor:6.1.7.Final
org.hibernate.validator:hibernate-validator-cdi:6.1.7.Final```

My import look like this
```import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;```

Everything seems to compile fine, but when I launch my program like this:
```java -cp target/swingy-1.2-SNAPSHOT.jar vv.swingy.Main```

I get this:
```Exception in thread "main" java.lang.NoClassDefFoundError: javax/validation/Validation
        at vv.swingy.game.Game.start(Game.java:21)
        at vv.swingy.Main.main(Main.java:9)
Caused by: java.lang.ClassNotFoundException: javax.validation.Validation
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 2 more```

And indeed, the dependencies are not in the jar file. What do I do wrong?
worldly hearthBOT
#

This post has been reserved for your question.

Hey @small sky! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

small sky
#

Include Hibernate dependency with Maven

solemn grove
#

Try the classes from jakarta.validation.

#
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;````