Reputation: 105
i am acessing a class, which is part of the Elasticsearch server. When i compile the code inside Eclipse, i have no problems. doing it in Maven i get an error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project flume-ng-elasticsearch-sink: Compilation failure
[ERROR] \Eclipse\Workspace\flume\flume-ng-sinks\flume-ng-elasticsearch-sink\src\main\java\org\apache\flume\sink\elasticsearch\client\ElasticSearchTransportClient.java:[202,19] error: cannot access Level
My code is:
Settings.Builder settingsBuilder = Settings.builder()
.put("cluster.name", clusterName);
The property "Level" is defined in a class from the Elasticsearch Project. Code is available here.
Any idea, which might be wrong?
thanks,
Helmut
Upvotes: 2
Views: 8183
Reputation: 2104
In my case the problem was a combination of two things.
First, the Java version of the dependency (the class that "cannot access") was way ahead of that of the project I am building now (17 versus 11), so the compiler would not understand it.
Second, the compiler version in the project I am building was too old, so it would not complain correctly about the class file version. I upgraded the compiler plugin (from 2.2 to 3.10.1) and then it would complain about a class file too advanced for the Java version I was using.
After those two corrections, I moved forward to later errors.
Upvotes: 0
Reputation: 105
Found the problem.
In pom file of the project the dependency to Log4J had a scope of "test", so it was not available to the compile scope.
Removed the scope test and all is fine now.
Upvotes: 2