Dependency error with Selenium 3.3.1 and FirefoxDriver - java

I use geckodriver v0.15.0 (Latest release) and Firefox 52.0.1 (64 bits)
Here is my code :
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
Here is the dependencies for Selenium in my pom (latest version of Selenium) :
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.3.1</version>
<scope>test</scope>
</dependency>
And the exception at runtime :
Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.net.PortProber.waitForPortUp(IILjava/util/concurrent/TimeUnit;)V
at org.openqa.selenium.firefox.GeckoDriverService.waitUntilAvailable(GeckoDriverService.java:73)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
If I add this dependency :
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.3.1</version>
</dependency>
I have got another exception :
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/Interactive
What dependency is missing? Thank you.
UPDATE
mvn dependency:tree with htmlunit-driver 2.25, selenium-remote-driver 3.3.1, selenium-firefox-driver 3.3.1, selenium-support 3.3.1
[INFO] +- org.seleniumhq.selenium:htmlunit-driver:jar:2.25:compile
[INFO] | +- org.seleniumhq.selenium:selenium-api:jar:2.53.1:compile
[INFO] | \- net.sourceforge.htmlunit:htmlunit:jar:2.21:compile
[INFO] | +- xalan:xalan:jar:2.7.2:compile
[INFO] | | \- xalan:serializer:jar:2.7.2:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | +- org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.17:compile
[INFO] | +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.21:compile
[INFO] | | \- xerces:xercesImpl:jar:2.11.0:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | +- net.sourceforge.cssparser:cssparser:jar:0.9.18:compile
[INFO] | | \- org.w3c.css:sac:jar:1.3:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | \- org.eclipse.jetty.websocket:websocket-client:jar:9.4.1.v20170120:compile
[INFO] | +- org.eclipse.jetty:jetty-util:jar:9.4.1.v20170120:compile
[INFO] | +- org.eclipse.jetty:jetty-io:jar:9.4.1.v20170120:compile
[INFO] | +- org.eclipse.jetty:jetty-client:jar:9.4.1.v20170120:compile
[INFO] | | \- org.eclipse.jetty:jetty-http:jar:9.4.1.v20170120:compile
[INFO] | \- org.eclipse.jetty.websocket:websocket-common:jar:9.4.1.v20170120:compile
[INFO] | \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.1.v20170120:compile
[INFO] +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.3.1:compile
[INFO] | +- cglib:cglib-nodep:jar:3.2.4:compile
[INFO] | +- org.apache.commons:commons-exec:jar:1.3:compile
[INFO] | \- net.java.dev.jna:jna-platform:jar:4.1.0:compile
[INFO] | \- net.java.dev.jna:jna:jar:4.2.2:compile
[INFO] +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.3.1:compile
[INFO] \- org.seleniumhq.selenium:selenium-support:jar:3.3.1:compile
Update 2
OS: Linux 64 bits

Here is the required dependencies (I cleaned the .m2 directory too) :
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.6</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.3.1</version>
</dependency>

Maybe you have jar versions conflict error. When I had that bug in my application, I found that it was referring the old Selenium jar. To resolve this, I removed the old jar's and rebuild the project with Selenium 3 jars.
Ensure that you have right libraries added to your project.
the command mvn dependency:tree can help you with this.
Note: when you use the test scope it's mean the the dependency is only available for the test compilation and execution phases, So you must put your code in a Test method or remove the scope tag
Hope this helps.

check if you have the selenium-java dependency of the same version as your other dependencies
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>

Add System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"\\geckodriver.exe"); to your code.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class CheckFireFox {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir")+"\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>StackOverFlow</groupId>
<artifactId>StackOverFlow</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>
</dependencies>
</project>
Console output :
Mar 27, 2017 2:39:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Page title is: Google

Update the selenium version
Download the geckodriver and set system path eg "F:\geckodriver-v0.20.1-win64"
Add following code snippet to your existing code
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
Now run the script and it will work for you, hope this helps.

Related

gRPC exception related with NameResolverProvider

I have a gRPC server written in Java, that is trying to access Firestore and other services, through a Service Account that has Project Owner roles. The server ran successfully plenty of times, but when I tried to run again, this happened:
Exception in thread "main" java.util.ServiceConfigurationError: io.grpc.NameResolverProvider: Provider io.grpc.grpclb.SecretGrpclbNameResolverProvider$Provider could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at io.grpc.ServiceProviders.loadAll(ServiceProviders.java:67)
at io.grpc.NameResolverRegistry.getDefaultRegistry(NameResolverRegistry.java:101)
at io.grpc.internal.AbstractManagedChannelImplBuilder.<init>(AbstractManagedChannelImplBuilder.java:107)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<init>(NettyChannelBuilder.java:136)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<init>(NettyChannelBuilder.java:131)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.forAddress(NettyChannelBuilder.java:117)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:37)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:23)
at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:39)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:270)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1500(InstantiatingGrpcChannelProvider.java:71)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:202)
at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:209)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:192)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:155)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:122)
at com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:122)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:90)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:82)
at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:561)
at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:385)
at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:67)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:73)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:66)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:541)
at services.FirestoreServiceActions.<init>(FirestoreServiceActions.java:25)
at CNTextServer.main(CNTextServer.java:47)
Caused by: java.lang.VerifyError: Cannot inherit from final class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 30 more
To simplify things and to turnaround some major problems that may happen on IntelliJ Idea,
I've created a much simpler (Maven) project that just has some code to start the server, and it worked fine, the server runs perfectly.
Although, when I add the line that initializes the Firestore service, the same Exceptions are thrown.
I have an environment variable (GOOGLE_APPLICATION_CREDENTIALS) pointing to a key of a service account that has Project Owner roles, just like I've mentioned before. I've also tried the FileInputStream alternative, pointing to the key, with no success.
The code of my simpler (Maven) project is:
private static final int SERVICE_PORT = 8000;
private Firestore firestoreService
public static void main(String[] args) {
try {
System.out.println("--> SETTING UP THE SERVER...");
GoogleCredentials credentials = GoogleCredentials.fromStream(new FileInputStream(SERVICE_ACCOUNT_KEY_PATH));
this.firestoreService = FirestoreOptions.newBuilder().setCredentials(credentials).build().getService();
Server service = ServerBuilder
.forPort(SERVICE_PORT)
.addService(new CNTextServer())
.build();
service.start();
System.out.println("--- SERVER STARTED. LISTENING ON PORT " + SERVICE_PORT);
System.out.println("--> PRESS 'ENTER' TO STOP THE SERVER");
Scanner scanner = new Scanner(System.in);
scanner.nextLine();
System.out.println("<-- SERVER SHUTTING DOWN...");
service.shutdown();
} catch (Exception ex) {
System.out.println("### EXCEPTION ON SERVER.MAIN() ###\n" + ex.getMessage());
}
}
The dependencies on the Maven pom.xml file are:
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.28.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.28.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.28.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-firestore</artifactId>
<version>1.34.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.108.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>1.106.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-compute</artifactId>
<version>0.118.0-alpha</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-vision</artifactId>
<version>1.99.3</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-translate</artifactId>
<version>1.94.5</version>
</dependency>
<dependency>
<groupId>leic.cn.li62d-g04</groupId>
<artifactId>CNTextContract</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/../CNTextContract/target/CNTextContract-1.0-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
Running mvn dependency:tree we see:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # examples ---
[INFO] com.example:examples:jar:1.0.0
[INFO] +- io.grpc:grpc-netty-shaded:jar:1.28.0:compile
[INFO] | \- io.grpc:grpc-core:jar:1.28.0:compile (version selected from constraint [1.28.0,1.28.0])
[INFO] +- io.grpc:grpc-protobuf:jar:1.28.0:compile
[INFO] | +- io.grpc:grpc-api:jar:1.28.0:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:3.11.0:compile
[INFO] | +- com.google.guava:guava:jar:28.1-android:compile
[INFO] | +- com.google.api.grpc:proto-google-common-protos:jar:1.17.0:compile
[INFO] | \- io.grpc:grpc-protobuf-lite:jar:1.28.0:compile
[INFO] +- io.grpc:grpc-stub:jar:1.28.0:compile
[INFO] +- com.google.cloud:google-cloud-firestore:jar:1.34.0:compile
[INFO] | +- com.google.cloud:google-cloud-core-grpc:jar:1.93.5:compile
...
[INFO] | +- io.grpc:grpc-context:jar:1.29.0:compile
[INFO] | +- com.google.api:gax:jar:1.56.0:compile
[INFO] | +- com.google.auth:google-auth-library-oauth2-http:jar:0.20.0:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] | +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.18:compile
[INFO] | +- com.google.api:gax-grpc:jar:1.56.0:compile
[INFO] | +- io.grpc:grpc-auth:jar:1.29.0:compile
[INFO] | +- io.grpc:grpc-alts:jar:1.29.0:compile
[INFO] | +- io.grpc:grpc-grpclb:jar:1.29.0:compile
The problem is that grpc-core is too old. You can see io.grpc:grpc-core:jar:1.28.0 and io.grpc:grpc-grpclb:jar:1.29.0:compile. grpclb depends on grpc-core 1.29.0. In 1.29.0 GrpclbNameResolver was added that extends DnsNameResolver from grpc-core. But in 1.28.0 DnsNameResolver was final. Downgrades are very likely to cause breakages.
To fix the version problem(s) (there's several), move the io.grpc dependencies to the end bump their versions to 1.29.0.
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-firestore</artifactId>
<version>1.34.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.108.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>1.106.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-compute</artifactId>
<version>0.118.0-alpha</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-vision</artifactId>
<version>1.99.3</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-translate</artifactId>
<version>1.94.5</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.29.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.29.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.29.0</version>
</dependency>
</dependencies>
Maven has poor transitive dependency resolution, and happily downgrades packages without any warning. It is good practice to use maven-enforcer's requireUpperBoundDeps to detect issues like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireUpperBoundDeps/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
With your broken dependencies, it would have noticed the downgrades:
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for io.grpc:grpc-netty-shaded:1.28.0 paths to dependency are:
+-com.example:examples:1.0.0
+-io.grpc:grpc-netty-shaded:1.28.0
and
+-com.example:examples:1.0.0
+-com.google.cloud:google-cloud-firestore:1.34.0
+-io.grpc:grpc-netty-shaded:1.29.0
,
Require upper bound dependencies error for io.grpc:grpc-protobuf:1.28.0 paths to dependency are:
+-com.example:examples:1.0.0
+-io.grpc:grpc-protobuf:1.28.0
and
+-com.example:examples:1.0.0
+-com.google.cloud:google-cloud-firestore:1.34.0
+-io.grpc:grpc-protobuf:1.29.0
and
+-com.example:examples:1.0.0
+-com.google.cloud:google-cloud-pubsub:1.106.0
+-io.grpc:grpc-protobuf:1.29.0
...

Intellij throws java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey but run with maven works

I'm trying to test a small snippet of code to see if I can connect to my local database with hibernate and create some tables and insert data.
package service;
import model.CategoryEntry;
import model.SubCategoryEntry;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
public class DatabaseConnectionTest {
#Test
public void databaseConnectionIsSuccessful() {
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
CategoryEntry categoryEntry = new CategoryEntry();
categoryEntry.setId(2269);
categoryEntry.setAlert(false);
categoryEntry.setLabel("Eat and Drink");
categoryEntry.setSlug("eat-drink");
List<CategoryEntry> subcategories = new ArrayList<>();
CategoryEntry subCategoryEntry1 = new CategoryEntry();
subCategoryEntry1.setId(9);
subCategoryEntry1.setAlert(false);
subCategoryEntry1.setLabel("Food");
subCategoryEntry1.setSlug("food");
subCategoryEntry1.setParent(categoryEntry);
subcategories.add(subCategoryEntry1);
categoryEntry.setSubcategories(subcategories);
try {
session.beginTransaction();
session.persist(categoryEntry);
session.getTransaction().commit();
session.close();
} catch (Exception e) {
e.getLocalizedMessage();
}
}
}
And the Entity Class:
package model;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.hibernate.annotations.Fetch;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
#Entity
public class CategoryEntry {
#Id
private int id;
private boolean alert = false;
private String label;
private String slug;
#ManyToOne(fetch = FetchType.EAGER)
#JoinColumn(name = "parent_id")
private CategoryEntry parent;
#OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "parent")
//#JoinColumn(name = "CATEGORY_ID")
private List<CategoryEntry> subcategories;
#JsonInclude(JsonInclude.Include.NON_DEFAULT)
#ManyToOne
private SearchAgentEntry searchAgentEntry;
//getters and setters
}
The problem is that when I run the code I get this error:
java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:3038)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1763)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:972)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:799)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:250)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:231)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:274)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:84)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:474)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:85)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:689)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
at service.DatabaseConnectionTest.databaseConnectionIsSuccessful(DatabaseConnectionTest.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
The interesting part is that when I run my project with
mvn install or mvn test
Everything works fine and I can see that I have my data saved in the database. So this makes me thing that there might be something wrong with IntelliJ rather than dependencies.
Here is my pom.xml file
<dependencies>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0-SP1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
</dependency>
<!--Resteasy -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<scope>provided</scope>
</dependency>
<!--<dependency>
<groupId>jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.3.19.Final-redhat-1</version>
</dependency>-->
<!-- Jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<!-- JPA & Hibernate-->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.3.4.Final</version>
</dependency>
<!-- Database -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
From other questions I saw that this probvlem occurs mostly to not updated jpa 2.0 dependencies and hibernate < 4.0. I checked if the right jars are used and everything looks fine
- javax.persistence-api is 2.2 and
- hibernate is 5.3
Here is my dependency tree as well
-- maven-dependency-plugin:3.0.1:tree (default-cli) # medbusters ---
[INFO] at.itsv.mobile.backend:medbusters:war:1.0.0-SNAPSHOT
[INFO] +- javax.enterprise:cdi-api:jar:1.0-SP1:provided
[INFO] | +- org.jboss.interceptor:jboss-interceptor-api:jar:1.1:provided
[INFO] | +- javax.annotation:jsr250-api:jar:1.0:provided
[INFO] | \- javax.inject:javax.inject:jar:1.0.0.redhat-6:provided
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.slf4j:slf4j-jdk14:jar:1.7.25:compile
[INFO] +- org.jboss.resteasy:resteasy-client:jar:3.0.19.SP4-redhat-1:provided
[INFO] | +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.19.SP4-redhat-1:provided
[INFO] | | +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar:1.0.0.Final-redhat-1:provided
[INFO] | | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final-redhat-1:provided
[INFO] | | \- javax.activation:activation:jar:1.1.1.redhat-5:provided
[INFO] | \- org.jboss.logging:jboss-logging:jar:3.3.1.Final-redhat-1:compile
[INFO] +- at.itsv.tools:sv-logging:jar:2016.4.0.eap7:compile
[INFO] | +- at.itsv.tools:sv-utils:jar:2016.4.0.eap7:compile
[INFO] | | \- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] | | \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] | +- at.itsv.tools:sv-errorhandling:jar:2016.4.0.eap7:compile
[INFO] | \- org.slf4j:slf4j-ext:jar:1.7.7.redhat-3:compile
[INFO] | \- ch.qos.cal10n:cal10n-api:jar:0.8.1:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.6:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.0:provided
[INFO] +- org.json:json:jar:20180130:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.7:compile
[INFO] +- org.jdom:jdom:jar:1.1:compile
[INFO] +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] +- org.hibernate:hibernate-core:jar:5.3.5.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.23.1-GA:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final-redhat-1:provided
[INFO] | +- org.jboss:jandex:jar:2.0.2.Final-redhat-1:compile
[INFO] | +- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] | +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.3.4.Final:compile
[INFO] +- org.mariadb.jdbc:mariadb-java-client:jar:2.2.6:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.12:compile
[INFO] | \- com.google.protobuf:protobuf-java:jar:2.6.0:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.3:test
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.6:test
[INFO] | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | \- commons-codec:commons-codec:jar:1.9:test
[INFO] \- commons-io:commons-io:jar:2.5:test
The IntelliJ version is 2018.2.1
I read almost all the open questions on stakoverflow and anywhere I could relate to that problem and nothing so far helped.
I'm also not super advances in IDE configurations and if the problem is in the IDE I wouldn't be able to solve it on my own.
Any Help would be appreciated
IntelliJ was using an old jdk version 1.8 and therefore was also using an older version of JPA (1.0) regardless the dependencies I added. I changed it to the newest jdk version I have installed on my computer and the problem was solved.
File -> Project Strucutre -> in Platform Settings - SDKs and from there choose the jdk folder.
The only dependency I needed is
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.5.Final</version>
</dependency>
It adds automatically javax-persistance-api:2.2 and hibernate
I started working with Java recently and I have never used IntelliJ before and I am not familiar with all the configuration that have to be kept in mind when working on a project. So something little like this configuration was ignored and cost me couple of days of my work :)

Elastic Search 5.6.4 pom transport issue

We are pointing to Elasticsearch 5.6.4. I used below entry in pom.xml:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.6.4</version>
</dependency>
When I created the dependency tree:
[INFO] +- org.elasticsearch.client:transport:jar:5.6.4:compile
[INFO] | +- org.elasticsearch:elasticsearch:jar:2.4.4:compile (version
managed from 5.6.4)
[INFO] | | +- org.apache.lucene:lucene-core:jar:5.5.2:compile
[INFO] | | +- org.apache.lucene:lucene-backward-codecs:jar:5.5.2:compile
Can someone help to resolve this. I need elasticsearch-5.6.4.jar, but I am getting run time issues.
<pre>
this resolved my issue
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.6.4</version>
</dependency>
</dependencies>
</dependencyManagement>
</pre>

Issue with Maven war Plugin

I am using maven to package my war file. I have some dependencies with provided as scope. When i do a maven clean install, the war is created successfully, but the transitive dependencies of the jars with scope as provided are included in my lib directory. Is there any way to remove them ?
Example scenario: Below is one of my dependency in pom
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${resteasy.version}</version>
<scope>provided</scope>
</dependency>
this one is including the jar activation-1.1.jar. Also the dependency tree for resteasy-jaxrs is like below.
[INFO] +- org.jboss.resteasy:resteasy-jaxrs:jar:2.3.6.Final:provided
[INFO] | +- org.jboss.resteasy:jaxrs-api:jar:2.3.6.Final:provided
[INFO] | +- javax.annotation:jsr250-api:jar:1.0:compile
[INFO] | +- javax.activation:activation:jar:1.1:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.1.2:provided
[INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.1.2:provided
[INFO] | \- net.jcip:jcip-annotations:jar:1.0:compile
The easiest way is to create a <dependencyManagement> tag and put the sub-dependency inside and set the scope to provided:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
That way the scope of your transitive-dependency is overwritten:
[INFO] | +- javax.annotation:jsr250-api:jar:1.0:provided (scope managed from compile)
[INFO] | +- javax.activation:activation:jar:1.1:provided (scope managed from compile)
Be sure to do a Maven-> Update Project and check the Force Update checkbox before checking the dependency:tree.
The above mentioned solution is not possible in case i have so many transitive dependencies coming in my lib. Finally got the maven exclusion which is working fine.
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${resteasy.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>

Weird issue running maven site (problems were encountered while processing the POMs)

I'm trying to run mvn site but I keep getting this error message every time. I've tried googling, but have not found any solutions. I'm currently on a Windows machine running maven from git bash.
[WARNING] Unable to create Maven project for org.crashub:crash.shell:pom:1.3.1 from repository.
org.apache.maven.project.InvalidProjectModelException: Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar # line 98, column 19
My pom-file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>primecheck</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
</parent>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
<dependencies>
<dependency>
<groupId>lt.velykis.maven.skins</groupId>
<artifactId>reflow-velocity-tools</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Reflow skin requires Velocity >= 1.7 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
</project>
Running mvn dependency:tree
[INFO] --- maven-dependency-plugin:2.9:tree (default-cli) # primecheck ---
[INFO] com.tomasruud:primecheck:war:1.0.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.2.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.2.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.2.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.3.RELEASE:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.14:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.5:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.5:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.5:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:4.1.6.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.1.6.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:1.2.3.RELEASE:compile
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.7.11:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.11:compile
[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.11:compile
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.1:compile
[INFO] | \- org.apache.logging.log4j:log4j-core:jar:2.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.2.3.RELEASE:compile
[INFO] | +- junit:junit:jar:4.12:compile
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:compile
[INFO] | | \- org.objenesis:objenesis:jar:2.1:runtime
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] | \- org.springframework:spring-test:jar:4.1.6.RELEASE:compile
[INFO] +- org.apache.commons:commons-math3:jar:3.4.1:compile
[INFO] \- org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.3.RELEASE:provided
[INFO] +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.20:provided
[INFO] +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.20:provided
[INFO] +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.20:provided
[INFO] \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.20:provided
I have found these 2 related issues:
https://jira.exoplatform.org/browse/CRASH-225
https://jira.codehaus.org/browse/MSHADE-185
So the cause seems to be in the Maven Shade Plugin: the CRaSH POM seems to use the Shade Plugin and then has the wrong, hardcoded systemPath.
According to http://www.crashub.org/:
CRaSH is officially embedded as Spring Boot remote shell.
So org.crashub:crash.shell:pom:1.3.1 seems to be related to Spring Boot, but I don't know what is meant by the warning: "Unable to create Maven project for [...]"
EDIT
Try to add the following dependency to your POM:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
<optional>true</optional>
</dependency>

Categories