2017-04-07 20 views
0

依存関係/プラグインでpom.xmlファイルのエラーが発生したようですが、このpomファイルを生成したMavenにプロジェクトを変換してこのpom.xmlファイルを生成しました。以下のエラーコードをご覧ください。 JavaコードそのものにEclipse STS(Java Spring)のエラーが含まれていないため、Javaコードのインポートに必要なすべてのjarファイルがインポートされています。 Javaプログラムを実行している依存関係やプラグインによるpom.xmlファイルのエラー

コンソールのエラー印刷:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory 
    at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:190) 
    at testingpushnotifications.Application.main(Application.java:10) 
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 2 more 

pom.xmlファイルは、Javaの春のプロジェクトでエラーを示しています。

<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>Spring-Android-Push-Notifications-FCM--master</groupId> 
    <artifactId>Spring-Android-Push-Notifications-FCM--master</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <build> 
    <resources> 
     <resource> 
     <directory>src/main/java</directory> 
     <excludes> 
      <exclude>**/*.java</exclude> 
     </excludes> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> <--- ERROR HERE 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.5.1</version> 
     <configuration> 
      <source/> 
      <target/> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

1.

エラーログコード@line 16の上からも、ライン上の大きな赤いXがあります: 'プラグイン' pom.xmlファイルの

Multiple annotations found at this line: 
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile 
    (execution: default-compile, phase: compile) 
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.5.1 or one of its 
    dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.5.1: 
    ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.5.1 from/to central 
    (https://repo.maven.apache.org/maven2): NullPointerException 
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile 
    (execution: default-testCompile, phase: test-compile) 

エラーライン16

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.5.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.5.1: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.5.1 from/to central (https://repo.maven.apache.org/maven2): NullPointerException pom.xml /Spring-Android-Push-Notifications-FCM--master line 16 Maven Project Build Lifecycle Mapping Problem 

EDITEDコメントに従って依存関係を追加します。結果=残りのエラーは解決されず、新しいエラーはありません。

<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>Spring-Android-Push-Notifications-FCM--master</groupId> 
    <artifactId>Spring-Android-Push-Notifications-FCM--master</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <build> 
    <resources> 
     <resource> 
     <directory>src/main/java</directory> 
     <excludes> 
      <exclude>**/*.java</exclude> 
     </excludes> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.5.1</version> 
     <configuration> 
     <source>1.8</source> 
     <target>1.8</target> 
     <dependency> 
    <groupId>commons-logging</groupId> 
    <artifactId>commons-logging</artifactId> 
    <version>1.2</version> 
</dependency> 
     </configuration> 
     </plugin> 
    </plugins> 
    <pluginManagement> 
     <plugins> 
      <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> 
      <plugin> 
       <groupId>org.eclipse.m2e</groupId> 
       <artifactId>lifecycle-mapping</artifactId> 
       <version>1.0.0</version> 
       <configuration> 
        <lifecycleMappingMetadata> 
         <pluginExecutions> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId> 
             org.apache.maven.plugins 
            </groupId> 
            <artifactId> 
             maven-compiler-plugin 
            </artifactId> 
            <versionRange> 
             [3.5.1,) 
            </versionRange> 
            <goals> 
             <goal>compile</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <ignore></ignore> 
           </action> 
          </pluginExecution> 
         </pluginExecutions> 
        </lifecycleMappingMetadata> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
    </build> 
</project> 
+0

ようにする必要があり、<dependency>タグの間違った場所に置きますあなたのmavenリポジトリにアクセスしてください。 'mvn -X help:help'は有用なことを教えてくれますか? – ninj

答えて

0

あなたがちょうどJavaのバージョンを追加しようと

<dependency> 
    <groupId>commons-logging</groupId> 
    <artifactId>commons-logging</artifactId> 
    <version>1.2</version> 
</dependency> 

を使用しているどんなバージョンのファイルをのpom.xmlにだけ依存関係を追加コモンズ・ロギング用の瓶を持っていないあなたのように思えますJava 8を使用していて、javaパスも設定しようとしている場合。

<source>1.8</source> 
<target>1.8</target> 
+0

これらのコードを新しいエラーなしで追加するように管理しましたが、以前のエラーは解決されませんでした。 – Rami

+0

あなたは間違った削除でcommons-logging依存関係タグを追加しました。ちょうどの外のcommons-logging依存関係タグを取り出してタグ – Moni

+0

の中にありがとうございます。しかし、私はこのメソッドを削除しました。フレームワーク。 – Rami

1

あなたはそれが<dependencies>タグに内部でなければならないですし、少しあなたができないように聞こえるそれは内部<build>タグはありませんが、それはこの

.... 
<version>0.0.1-SNAPSHOT</version> 

<dependencies> 
    <dependency> 
     <groupId>commons-logging</groupId> 
     <artifactId>commons-logging</artifactId> 
     <version>1.2</version> 
    </dependency> 
</dependencies> 

<build> 
..... 
関連する問題