2017-09-21 39 views
0

すべての依存関係(私のプロジェクト、junitなど)と確実なプラグインを追加しました。それはEclipseで正常に実行されますが、コマンドプロンプトを実行するとエラーがスローされます。以下は添付のスクリーンショットです。およびpom.xmlファイル。日食works.mavenの場所にembeeded Mavenの設定は、通常、日食、独自のMavenのバージョンが付属して、コマンドプロンプト BUILD FAILURE ERRORコマンドプロンプトからmavenコマンドを実行できませんが、eclipseを通じて正常に実行されます

<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.selenium</groupId> 
    <artifactId>test</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 

<dependencies> 

<!-- https://mvnrepository.com/artifact/org.testng/testng --> 
<dependency> 
    <groupId>org.testng</groupId> 
    <artifactId>testng</artifactId> 
    <version>6.11</version> 
    <scope>test</scope> 
</dependency> 


<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server 
<dependency> 
    <groupId>org.seleniumhq.selenium</groupId> 
    <artifactId>selenium-server</artifactId> 
    <version>2.53.1</version> 
</dependency> 
--> 
<!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver --> 
<dependency> 
    <groupId>com.codeborne</groupId> 
    <artifactId>phantomjsdriver</artifactId> 
    <version>1.3.0</version> 
</dependency> 



    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> 
<dependency> 
    <groupId>org.seleniumhq.selenium</groupId> 
    <artifactId>selenium-java</artifactId> 
    <version>2.53.1</version> 
</dependency> 

    <!-- https://mvnrepository.com/artifact/log4j/log4j --> 
<dependency> 
    <groupId>log4j</groupId> 
    <artifactId>log4j</artifactId> 
    <version>1.2.17</version> 
</dependency> 



    <!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail --> 
<dependency> 
    <groupId>com.sun.mail</groupId> 
    <artifactId>javax.mail</artifactId> 
    <version>1.5.6</version> 
</dependency> 
    <!-- https://mvnrepository.com/artifact/org.uncommons/reportng --> 
<dependency> 
    <groupId>org.uncommons</groupId> 
    <artifactId>reportng</artifactId> 
    <version>1.1.4</version> 
    <scope>test</scope> 
</dependency> 
    <!-- https://mvnrepository.com/artifact/com.google.inject/guice --> 
<dependency> 
    <groupId>com.google.inject</groupId> 
    <artifactId>guice</artifactId> 
    <version>4.1.0</version> 
</dependency> 

    <dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.12</version> 
    <scope>test</scope> 
</dependency> 

    <!-- Dependency for POI API --> 
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi --> 
<dependency> 
    <groupId>org.apache.poi</groupId> 
    <artifactId>poi</artifactId> 
    <version>3.17</version> 
</dependency> 
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> 
<dependency> 
    <groupId>org.apache.poi</groupId> 
    <artifactId>poi-ooxml</artifactId> 
    <version>3.17</version> 
</dependency> 

    </dependencies> 


    <build> 
    <plugins> 
    <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.18.1</version> 
       <configuration> 
        <testFailureIgnore> false </testFailureIgnore> 
        <suiteXmlFiles> 
         <suiteXmlFile>src/test/resources/runner/testng.xml</suiteXmlFile> 
        </suiteXmlFiles> 
       </configuration> 

       </plugin> 

     </plugins> 
    </build> 


</project> 
+0

あなたのpom.xmlの '' 情報を共有できるください、あなたはFRを何のコマンドを実行していますomコマンドプロンプト? – nullpointer

+0

異なるバージョンのMavenがインストールされている可能性があります。あなたの日食と端末mavenが同じであることを確認してください –

+0

この回答をチェックしてくださいhttps://stackoverflow.com/questions/46049166/maven-compilation-error-when-run-through-command-line-cucumber-maven-project/ 46049751#46049751 –

答えて

1

、それはMavenのは、このリモートMavenの中央リポジトリからdepedency jarをダウンロードしようと言う:このリポジトリは、SSLサイトですのでhttps://repo.maven.apache.org/maven2/

、あなたはにその認定をインストールする必要がありますauthを渡します。 MavenはJDKによって実行されるため、証明書をJDK Security Storeにインポートする必要があります。

eclipseで渡すことができる理由は、eclipseが別のsettings.xmlをrun mavenコマンドとして使用することです。おそらくeclipseはSSLリポジトリを使用しません。

2つのオプションがあります。
1)HTTPリポジトリを指定し、SSL Mavenのリモートリポジトリを使用しないでください:以下のように、あなたのmanveのsettings.xmlでhttp://repo1.maven.org/maven2を:

<activeProfiles> 
    <!--make the profile active all the time --> 
    <activeProfile>securecentral</activeProfile> 
    </activeProfiles> 
    <profiles> 
    <profile> 
     <id>securecentral</id> 
     <!--Override the repository (and pluginRepository) "central" from the 
     Maven Super POM --> 
     <repositories> 
     <repository> 
      <id>central</id> 
      <url>http://repo1.maven.org/maven2</url> 
      <releases> 
      <enabled>true</enabled> 
      </releases> 
     </repository> 
     </repositories> 
     <pluginRepositories> 
     <pluginRepository> 
      <id>central</id> 
      <url>http://repo1.maven.org/maven2</url> 
      <releases> 
      <enabled>true</enabled> 
      </releases> 
     </pluginRepository> 
     </pluginRepositories> 
    </profile> 
    </profiles> 

2)輸入証明書は、 JDKセキュリティストア
この記事にインポートする手順を見つける: Problems using Maven and SSL behind proxy

+0

ありがとうございました。私は1ヶ月以来これにこだわっていた – heardm

1

私はあなたが二つの異なるMavenを使用していると思うから認識なっています。 Eclipseとコマンドプロンプトで同じMavenインストールを使用していることを確認できます。

eclipseでMavenインストールを確認するには、 Preference - > Maven - > Installationに行ってください。

コマンドプロンプトから、Mavenホーム/ M2ホームを確認します。エラーから

Maven installation verify in eclipse

+0

ので、まさに私が何をすべきか。私はemededとして選択されます。コマンドプロンプトで – heardm

+0

をクリックすると、ダウンロードしたMavenパスの場所が表示されます – heardm

+0

「追加」ボタンを使用して外部Mavenを追加します。コマンドプロンプトに表示されるmavenを選択します。そして、エラーを解決してください。 Pomファイルを共有できれば、問題の特定に役立ちます – Yogi

関連する問題