Доброго времени суток, коллеги!
Столкнулся со следующей ситуацией по которой нужен добрый совет.
И так. Есть бызовый проект, в котором лежат “базовые” классы работы с разными модулями: webdriver, httpclient… POM:
<?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>bese_project</groupId>
<artifactId>bese_project</artifactId>
<version>1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- ======================= VERSIONS ======================= -->
<java.version>1.8</java.version>
<log4j.version>1.2.17</log4j.version>
<slf4j-simple.version>1.7.18</slf4j-simple.version>
<selenide.version>4.5</selenide.version>
<json.version>20140107</json.version>
<commons-codec.version>1.10</commons-codec.version>
<rest-assured.version>2.8.0</rest-assured.version>
<jsoup.version>1.10.3</jsoup.version>
<javax.mail.version>1.5.6</javax.mail.version>
<compiler.plugin.version>3.6.0</compiler.plugin.version>
<surefire.plugin.version>2.19.1</surefire.plugin.version>
<allure.version>2.0-BETA16</allure.version>
<aspectj.version>1.8.10</aspectj.version>
<!-- ======================= VERSIONS ======================= -->
</properties>
<dependencies>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-sheets</artifactId>
<version>v4-rev481-1.22.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j-simple.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>${selenide.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>${javax.mail.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.27</version>
</dependency>
</dependencies>
</project>
И есть тестовый проект, т.е. проект, в котором непосредственно лежат тесты и в который подключается “базовый”. POM:
<?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>test_project</groupId>
<artifactId>test_project</artifactId>
<version>1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.plugin.version>3.6.0</compiler.plugin.version>
<java.version>1.8</java.version>
<surefire.plugin.version>2.19.1</surefire.plugin.version>
<aspectj.version>1.8.10</aspectj.version>
<allure.results.directory>
${project.build.directory}/allure-results
</allure.results.directory>
</properties>
<repositories>
<repository>
<id>google-api-services</id>
<url>https://oss.sonatype.org/content/repositories/releases/</url>
</repository>
<repository>
<id>google-api-services-beta</id>
<url>http://google-api-client-libraries.appspot.com/mavenrepo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>base_project</groupId>
<artifactId>base_project</artifactId>
<version>1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.plugin.version}</version>
<configuration>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
</properties>
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${allure.results.directory}</value>
</property>
</systemProperties>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Появилась необходимость добавить функционал работы с Google Sheets посредством Java API. Согласно дока гугла добавил 3 зависимости в “базовый” проект:
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-sheets</artifactId>
<version>v4-rev481-1.22.0</version>
</dependency>
При запуске теста получил:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.425 s
[INFO] Finished at: 2017-08-02T18:30:57+03:00
[INFO] Final Memory: 31M/274M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project ***: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] java.util.ServiceConfigurationError: org.testng.ITestNGListener: Provider io.qameta.allure.testng.AllureTestNg could not be instantiated
[ERROR] at java.util.ServiceLoader.fail(ServiceLoader.java:232)
[ERROR] at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
[ERROR] at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
[ERROR] at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
[ERROR] at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
[ERROR] at org.testng.TestNG.addServiceLoaderListeners(TestNG.java:1017)
[ERROR] at org.testng.TestNG.initializeConfiguration(TestNG.java:966)
[ERROR] at org.testng.TestNG.run(TestNG.java:1089)
[ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:132)
[ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
[ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:147)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
[ERROR] Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
[ERROR] at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:564)
[ERROR] at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:474)
[ERROR] at io.qameta.allure.model.Allure2ModelJackson.createMapper(Allure2ModelJackson.java:24)
[ERROR] at io.qameta.allure.FileSystemResultsWriter.<init>(FileSystemResultsWriter.java:30)
[ERROR] at io.qameta.allure.AllureLifecycle.getDefaultWriter(AllureLifecycle.java:281)
[ERROR] at io.qameta.allure.AllureLifecycle.<init>(AllureLifecycle.java:47)
[ERROR] at io.qameta.allure.Allure.getLifecycle(Allure.java:30)
[ERROR] at io.qameta.allure.testng.AllureTestNg.<init>(AllureTestNg.java:107)
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[ERROR] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[ERROR] at java.lang.Class.newInstance(Class.java:442)
[ERROR] at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
[ERROR] ... 12 more
Как я понимаю, суть проблемы в “Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z”
Строил дерево зависимостей, смотрел конфликты - не нашел. Собственно и возник вопрос: каким образом зависимости из библиотек влияют на зависимости друг друга. Я наверно что-то не до конца понимаю в maven-e, но, вроде, такого “влияния” не должно быть? Почему зависимости из одного пакета “влияют” на зависимости другого и как исключить такое влияние? Или проблема в другом?