1

aws-sdk-javaを使用して競合の問題が発生しました。エラー「Aws-sdk-java」がMavenと競合します

私はすでにいくつかのことを試みました。私はいくつかのトピックを研究しました。私は解決できません。

java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.enable (Lcom/fasterxml/jackson/core/JsonParser $ Feature;) Lcom/fasterxml/jackson/databind/ObjectMapper;

私の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>com.matheus.api</groupId> 
<artifactId>matheus.api</artifactId> 
<version>1.0.25.1</version> 
<packaging>war</packaging> 
<name>matheus.api</name> 

<properties> 
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.6.1</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
       <compilerArguments> 
        <endorseddirs>${endorsed.dir}</endorseddirs> 
       </compilerArguments> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>3.1.0</version> 
      <configuration> 
       <failOnMissingWebXml>false</failOnMissingWebXml> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <version>3.0.1</version> 
      <executions> 
       <execution> 
        <phase>validate</phase> 
        <goals> 
         <goal>copy</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>${endorsed.dir}</outputDirectory> 
         <silent>true</silent> 
         <artifactItems> 
          <artifactItem> 
           <groupId>javax</groupId> 
           <artifactId>javaee-endorsed-api</artifactId> 
           <version>6.0</version> 
           <type>jar</type> 
          </artifactItem> 
         </artifactItems> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>com.amazonaws</groupId> 
      <artifactId>aws-java-sdk-bom</artifactId> 
      <version>1.11.78</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>org.glassfish.jersey.core</groupId> 
     <artifactId>jersey-client</artifactId> 
     <version>2.25</version> 
    </dependency> 
    <dependency> 
     <groupId>org.glassfish.jersey.media</groupId> 
     <artifactId>jersey-media-multipart</artifactId> 
     <version>2.25</version> 
     <type>jar</type> 
    </dependency> 
    <dependency> 
     <groupId>com.thetransactioncompany</groupId> 
     <artifactId>cors-filter</artifactId> 
     <version>2.6</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.mail</groupId> 
     <artifactId>javax.mail-api</artifactId> 
     <version>1.6.0</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.mail</groupId> 
     <artifactId>mail</artifactId> 
     <version>1.4.7</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.ws.rs</groupId> 
     <artifactId>javax.ws.rs-api</artifactId> 
     <version>2.0.1</version> 
    </dependency> 
    <dependency> 
     <groupId>javax</groupId> 
     <artifactId>javaee-web-api</artifactId> 
     <version>7.0</version> 
     <type>jar</type> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate.javax.persistence</groupId> 
     <artifactId>hibernate-jpa-2.1-api</artifactId> 
     <version>1.0.0.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>org.json</groupId> 
     <artifactId>json</artifactId> 
     <version>20170516</version> 
    </dependency> 
    <dependency> 
     <groupId>org.eclipse.persistence</groupId> 
     <artifactId>eclipselink</artifactId> 
     <version>2.6.4</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-email</artifactId> 
     <version>1.4</version> 
    </dependency> 


    <dependency> 
     <groupId>org.postgresql</groupId> 
     <artifactId>postgresql</artifactId> 
     <version>9.4.1208.jre7</version> 
    </dependency> 

    <dependency> 
     <groupId>com.google.code.gson</groupId> 
     <artifactId>gson</artifactId> 
     <version>2.6.2</version> 
    </dependency> 

    <dependency> 
     <groupId>com.sun.xml.security</groupId> 
     <artifactId>xml-security-impl</artifactId> 
     <version>1.0</version> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-lang3</artifactId> 
     <version>3.6</version> 
    </dependency> 

    <dependency> 
     <groupId>com.google.apis</groupId> 
     <artifactId>google-api-services-calendar</artifactId> 
     <version>v3-rev262-1.23.0</version> 
     <exclusions> 
      <exclusion> 
       <groupId>com.google.guava</groupId> 
       <artifactId>guava-jdk5</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 

    <dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk-sns</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk-s3</artifactId> 
    </dependency> 
</dependencies> 

+0

[もっと速い回答を得るために、どのような状況で「緊急」や他の類似のフレーズを追加することができますか?](// meta.stackoverflow.com/q/326569) - 要約は、ボランティアに対処する理想的な方法ではなく、おそらく回答を得ることに逆効果があります。これをあなたの質問に追加しないでください。 – halfer

+0

申し訳ありません、ありがとうございます! – mPissolato

+0

引用符ではなくコードブロックで完全なスタックトレースで質問を更新してください。 – kdgregory

答えて

1

あなたはBOM経由での依存関係を取るのではなく、bundle依存関係をチェックアウトすることをお勧めします。 hereをよく説明しましたが、依存関係を過渡的に解決しようとするのではなく、Java用のAWS SDKに必要なサードパーティのクラスをすべて効果的にバンドル(および再配置)して1つのユーバーJARにします。これは、Maven Shadeプラグインを使用して行います。

+0

返信いただきありがとうございます。この60Mbの大きなプロジェクトは巨大になります。 – mPissolato

+0

はい、それは欠点です。もう1つの選択肢は、あなた自身がソースからSDKのバージョンを作成してプロジェクトに組み込むことができるということです。 Maven [Shade](https://maven.apache.org/plugins/maven-shade-plugin/)プラグインをチェックしてください。もちろん、これはビルド/アーティファクトを自分で管理することを意味します。 – kiiadi

+0

例がありますか? Tks – mPissolato

関連する問題