I have a problem running my CI builds on Travis with Java9 (Oracle JDK 9).
I fails on maven-site-plugin - after removing it everything works smothly.
I tried removing everything else to check for possible dependencies collisions, left out with just this one plugin build still fails. It is just a pom container, still failing with just a simple site plugin (updated to latest version that claimed to be java9 ready).
Here are all of the resources:
failing Travis build
Travis configuration
project POM file
Looking for similar problems on the web I found that usually it's plugin compatibility (all of the plugins ware updated) or different dependencies versions, but I removed all of them and it still fails.
The builds run locally on OpenJDK 9 perfectly fine.
-edit-
After applying hint from #nullpointer :
updated POM
CI error
You should probably wait and update to using version 3.7 of site plugin as mentioned here.
Seems like you are encountering something similar to #MSITE-796
Quoting further from the same link:-
The release will need a little bit more time due to pending
SNAPSHOT-dependencies which need to be released first. So either have
a little bit more patience or add doxia-sitetools 1.7.5 as a dependency
to the maven-site-plugin in your own project.
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sitetools</artifactId>
<version>1.7.5</version>
</dependency>
-edit-
As doxia-sitetools is just a pom container project one needs to update all of it's modules directly:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.6</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-decoration-model</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-skin-model</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-integration-tools</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-doc-renderer</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
</plugin>
Related
I have a Spring Boot app that i run in a docker container using docker-compose.
I recently added the reactor-extra dependency to my pom.xml and for some reason i can't start the container anymore.
Here's what i added to the pom:
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>
<version>3.4.2</version>
</dependency>
Now whenever i try to start the container i get this error:
Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline (default-cli) on project backend: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.5.2 in central
The code works fine when i run it directly on intellij and there are apparently no dependency issues.
I took a look here: https://mvnrepository.com/artifact/io.projectreactor.addons/reactor-extra/3.4.2
and it seems that this "4.5.2" version of org.eclipse.swt.gtk.linux.x86_64 does not exist. I assume this works on intellij because this is an optional dependency but the container building process fails when it tries to download that version.
I tried excluding it like so:
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>
<version>3.4.2</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
</exclusion>
</exclusions>
</dependency>
But it's still trying to download it and i get the same error which causes the build to fail.
I also tried adding the existing 4.3 version of org.eclipse.swt.gtk.linux.x86_64 to my pom but i still get the same result.
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>io.projectreactor.addons</groupId>
<artifactId>reactor-extra</artifactId>
<version>3.4.2</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
</exclusion>
</exclusions>
</dependency>
How can i prevent maven from trying to download that dependency?
I fixed it by adding this to my pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
</plugin>
Source:
go-offline fails when optional dependencies cannot be resolved
https://issues.apache.org/jira/browse/MDEP-690
"Running org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline against this project passes. With version 3.1.2 the goal fails with:"
org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.5.2 in central (https://repo.maven.apache.org/maven2)
I'm trying to use google-vision to fetch text from an image (uploaded to AWS S3) and store it in AWS Dynamo DB. I'm encountering dependency conflicts on jackson-core as both google-api and aws-java-sdk are using two different versions.
Dependency Hierarchy
google-api-client: 1.22.0 uses jackson-core: 2.1.3
google-cloud-vision: 0.22.0-beta uses jackson-core: 2.1.3
aws-java-sdk: 1.11.106 uses jackson-core: 2.6.6
I tried "exclusions" and added explicit dependency in pom.xml to use jackson-core: 2.6.6. Google-vision api works fine with that change. However, AmazonDynamoDBClientBuilder fails with below error:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.amazonaws.AmazonWebServiceClient.<init>(Lcom/amazonaws/client/AwsSyncClientParams;)V from class com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder.build(AmazonDynamoDBClientBuilder.java:60)
at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder.build(AmazonDynamoDBClientBuilder.java:26)
at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
at com.oneglint.ImageProcessing.AddItem.main(AddItem.java:133)
Following error is displayed when there was version conflict
Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:537)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:448)
at com.amazonaws.partitions.PartitionsLoader.<clinit>(PartitionsLoader.java:51)
at com.amazonaws.regions.RegionMetadataFactory.create(RegionMetadataFactory.java:30)
at com.amazonaws.regions.RegionUtils.initialize(RegionUtils.java:64)
at com.amazonaws.regions.RegionUtils.getRegionMetadata(RegionUtils.java:52)
at com.amazonaws.regions.RegionUtils.getRegion(RegionUtils.java:105)
at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:239)
at com.oneglint.ImageProcessing.AddItem.main(AddItem.java:132)
What am I missing here? Thanks for the help..
BTW, I'm using example code from github to achieve this. Here are the links:
DynamoDB example: https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/java/example_code/dynamodb
Google Vision DetectText example: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/vision/cloud-client/src/main/java/com/example/vision/Detect.java
Additional Details
Both the examples are working fine if executed as independent projects. The problem occurs ONLY when both PutItem (AWS) & Detect (google-vision) classes are brought together in a single project, with appropriate code changes.
You can only have one version of jackson-core in your project. The easiest way to fix a version is to use <dependencyManagement> to set a version.
Your main problem is that jackson-core: 2.6.6 is not compatible with AmazonDynamoDBClientBuilder. The usual strategy is to try all versions from 2.1.3 to 2.6.6 until one of them works. If not, you can try to find versions of your amazon and google jars that require the same Jackson-core-version. In any case, this stupid and boring try-and-error.
If you do not come to any working solution, you can try to shade classes with maven-shade-plugin (I have not tried this, probably difficult) or you need to change your project in a way that not both dependencies are required.
After a lot of trial and error approach, the issue is finally solved.
It appears that I added multiple versions of aws-java-sdk jars during the process and an opennlp jar was associated with the project for some other module.
I had removed conflicting versions of aws-java-sdk and unnecessary libraries. Also, removed the exclusions and retained only the dependency addition in <dependencymanagement> for jackson-core.
Dependencies in my final pom listed below:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.106</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.6.6</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-vision</artifactId>
<version>v1-rev358-1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.22.0</version>
<exclusions>
<exclusion> <!-- exclude an old version of Guava -->
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-vision</artifactId>
<version>0.22.0-beta</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
</dependency>
</dependencies>
Hope this helps others..
Today, I have found a bug with Eclipse Neon and Neon.1.
On my project, when I use this dependency :
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.10</version>
</dependency>
On screen "Dependency Hierarchy", I see my "jaxws-rt : 2.2.10", but no dependencies are linked with this library.
If I downgrade the library to version 2.2.7, it works correctly.
If I use old Eclipse Mars, it works correctly with 2.2.10.
If I run a maven build inside or outside Eclipse, it works fine.
I am looking for changes between Eclipse Mars and Neon. I found an upgrade of Maven Embedded version, from 3.3.3 to 3.3.9. It's not necessary to install a new runtime of maven, because Eclipse will use Embedded version for dependency resolution.
I compare pom of 2.2.10 and 2.2.7, and I see that last version is really different for dependencies, because I don't find any version of each dependency. I don't know how it works, but it works outside Eclipse Neon.
Do you think problems come from jaxws-rt library or maven version inside Eclipse Neon ?
Thanks for you help !
Ok, just faced this today with a new Eclipse installation. Turns out if your Eclipse is running on a JRE and not on a JDK, bad things are going to happen with the embedded maven.
The solution is to open eclipse.ini and add/change the below line
-vm C:/Java/JDK8/bin/javaw.exe
(Obviously the path needs to be pointing to javaw.exe inside a JDK installation directory.)
Got the same issue, nothing worked for me from all the answers. I tried:
I downloaded Mars 1, Mars 2, Luna.
Changed the -vm parameter in eclipse.ini file to use my jdk1.8.0_151
Clear all references in eclipse that point to JRE jre.8.0_151.
I think the root cause of this issue is multiple version conflicts across JDK 1.8, jax, eclipse and even jaxws-spring(if you use one).
What worked for me:
1. finally upgrade the jaxws-rt from 2.2.10 to 2.3.0.2.
<!-- JAX-WS -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.0.2</version>
</dependency>
2. Keep the 2.2.10, but manually include all child dependence for that version:
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.stream.buffer/streambuffer -->
<dependency>
<groupId>com.sun.xml.stream.buffer</groupId>
<artifactId>streambuffer</artifactId>
<version>1.5.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.ws/policy -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>policy</artifactId>
<version>2.7.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jvnet.staxex/stax-ex -->
<dependency>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
<version>1.7.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.gmbal/gmbal-api-only -->
<dependency>
<groupId>org.glassfish.gmbal</groupId>
<artifactId>gmbal-api-only</artifactId>
<version>3.2.0-b003</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.ha/ha-api -->
<dependency>
<groupId>org.glassfish.ha</groupId>
<artifactId>ha-api</artifactId>
<version>3.1.9</version>
</dependency>
Thankfully my project compiled and worked well after that.
I think you have to endorse jaxws-rt dependcies.
I got the same issue and found this post.
I am using Firefox 45.0 and Dependency added in pom.xml is
selenium-firefox-driver 2.53.0.
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
at TestFIles_MDM.Test_Authn.setup(Test_Authn.java:27)
Error is coming for both Firefox and Chrome.
How can I resolve it, it was working last week.
I think you are missing this dependency in pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
Check Selenium docs about Maven dependencies.
Voila, It's worked for me.Just updated the selenium-java dependency in pom.xml
<!-- Selenium java-jar dependency -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
Or here is the link to get the updated version-
https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
Run mvn dependency:tree in your project, and check what is transitively depending on selenium-remote-driver.
In my project, I was correctly depending on selenium-java at 2.53.1, but another test dependency was depending on an older version (2.40.0); that meant my tests were using the 2.40.0 version of selenium-remote-driver at runtime, which causes the java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException error.
If you have transitive dependencies on selenium-remote-driver, you have two options for "fixing" them:
Update the artifact that's depending on the older version to either
Not depend on the artifact at all, or
Use the latest version.
Add an entry in your pom.xml's <dependencyManagement> section for selenium-java to peg the artifact at version 2.53.1.
This will affect the version of selenium-java both in your project and all your nested maven dependencies, too; be aware that those nested artifacts may not work well with the latest version!
It's also worth mentioning that selenium-java version 2.53.0 had a Firefox incompatibility problem; version 2.53.1 allegedly fixes that. See http://seleniumsimplified.com/2016/06/use_selenium_webdriver_jar_locally/ for more details.
Hope this helps :)
This happened with me while trying to update to remote driver to 3.0.1 from 2.53.1. I just reverted it back to 2.53.1 and it went away
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>2.53.1</version>
</dependency>
I ran into this too. I changed to the following and it went away.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>4.0.0-alpha-2</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>
In the pom.xml, i include logback & SLF4J like below, this works perfectly fine using maven build. It will give compilation error if i import directly from logback.
<dependencyManagement>
<dependencies>
<!-- We want to have slf4j with scope compile -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- logback we only want runtime, compiletime we want SLF4J -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
But how can I make eclipse honor the runtime scope of logback dependency and prevent import-suggestions from there?
Unfortunately it seems not to be possible on Eclipse with a normal build, as mentioned by #A4L, it is a known bug, check Bug 414645 and Bug 376616. Eclipse (m2e) can't properly manage Maven dependencies scope.
However, if you place the runtime dependencies on a profile, then Eclipse will not add them to the classpath (the profile shouldn't be active by default, though). I just tested it on Eclipse Mars and it works perfectly.
Hence, in your case you could add to your POM:
<profiles>
<profile>
<id>runtime</id>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
As such, it can't be used to compile on Eclipse. However, your build would then need to use it at runtime, running with -Pruntime in this case.
Although adapting your POM and build to an issue of an IDE might not be ideal, it could be a good compromise to achieve your goal.