2016-09-16 24 views
-1

Project Structureは私がCMD使用のpom.xmlを実行しようとしています

ゴールorg.apache.maven.pluginsの実行に失敗しましたが、私はMVNなどのコマンドを使用していたときに、私は次のエラーを取得していますインストールし、最初のものです第二は、添付cmdが窓を結果でありながらのpom.xmlは、

の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>tiger</groupId> 
    <artifactId>SampleProject</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>SampleProject</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.48.2</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi</artifactId> 
      <version>3.13</version> 
     </dependency> 

     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 

     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.9.10</version> 
     </dependency> 

     <!-- //for Reportng(guice ,velocity is added) --> 
     <dependency> 
      <groupId>org.uncommons</groupId> 
      <artifactId>reportng</artifactId> 
      <version>1.1.4</version> 
     </dependency> 

     <dependency> 
      <groupId>com.google.inject</groupId> 
      <artifactId>guice</artifactId> 
      <version>3.0</version> 
     </dependency> 

     <dependency> 
      <groupId>velocity</groupId> 
      <artifactId>velocity-dep</artifactId> 
      <version>1.4</version> 
     </dependency> 
    <!--  
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>6.0.2</version> 
     </dependency> --> 

    </dependencies> 

    <build> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <version>2.19.1</version> 

        <!-- <configuration> 
         <suiteXmlFiles> 
          <suiteXmlFile>testng.xml</suiteXmlFile> 
         </suiteXmlFiles> 
        </configuration> 
--> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 
    <!-- <reporting> <plugins> TestNG-xslt related configuration. <plugin> <groupId>org.reportyng</groupId> 
     <artifactId>reporty-ng</artifactId> <version>1.2</version> <configuration> 
     Output directory for the testng xslt report <outputDir>/target/testng-xslt-report</outputDir> 
     <sortTestCaseLinks>true</sortTestCaseLinks> <testDetailsFilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testDetailsFilter> 
     <showRuntimeTotals>true</showRuntimeTotals> </configuration> </plugin> </plugins> 
     </reporting> --> 


</project> 

CMD:

<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>tiger</groupId> 
    <artifactId>SampleProject</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>SampleProject</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.48.2</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi</artifactId> 
      <version>3.13</version> 
     </dependency> 

     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 

     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.9.10</version> 
     </dependency> 

     <!-- //for Reportng(guice ,velocity is added) --> 
     <dependency> 
      <groupId>org.uncommons</groupId> 
      <artifactId>reportng</artifactId> 
      <version>1.1.4</version> 
     </dependency> 

     <dependency> 
      <groupId>com.google.inject</groupId> 
      <artifactId>guice</artifactId> 
      <version>3.0</version> 
     </dependency> 

     <dependency> 
      <groupId>velocity</groupId> 
      <artifactId>velocity-dep</artifactId> 
      <version>1.4</version> 
     </dependency> 
    <!--  
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>6.0.2</version> 
     </dependency> --> 

    </dependencies> 

    <build> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <version>2.19.1</version> 

        <!-- <configuration> 
         <suiteXmlFiles> 
          <suiteXmlFile>testng.xml</suiteXmlFile> 
         </suiteXmlFiles> 
        </configuration> 
--> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 
    <!-- <reporting> <plugins> TestNG-xslt related configuration. <plugin> <groupId>org.reportyng</groupId> 
     <artifactId>reporty-ng</artifactId> <version>1.2</version> <configuration> 
     Output directory for the testng xslt report <outputDir>/target/testng-xslt-report</outputDir> 
     <sortTestCaseLinks>true</sortTestCaseLinks> <testDetailsFilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testDetailsFilter> 
     <showRuntimeTotals>true</showRuntimeTotals> </configuration> </plugin> </plugins> 
     </reporting> --> 


</project> 
CMD RESULT: 


C:\Users\Shashank_bisht\workspace\SampleProject>mvn clean install 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building SampleProject 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[WARNING] The POM for org.testng:testng:jar:5.14.3 is invalid, transitive dependencies (if any) will not be ava 
ilable, enable debug logging for more details 
[WARNING] The POM for org.testng:testng:jar:5.14.4 is invalid, transitive dependencies (if any) will not be ava 
ilable, enable debug logging for more details 
[WARNING] The POM for org.testng:testng:jar:5.14.5 is invalid, transitive dependencies (if any) will not be ava 
ilable, enable debug logging for more details 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ SampleProject --- 
[INFO] Deleting C:\Users\Shashank_bisht\workspace\SampleProject\target 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SampleProject --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] skip non existing resourceDirectory C:\Users\Shashank_bisht\workspace\SampleProject\src\main\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ SampleProject --- 
[INFO] Changes detected - recompiling the module! 
[INFO] Compiling 12 source files to C:\Users\Shashank_bisht\workspace\SampleProject\target\classes 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] /C:/Users/Shashank_bisht/workspace/SampleProject/src/main/java/tiger/Marketing/CreateLeadPage.java:[8,4 
7] package tiger.SampleProject.MyHomepageTestCases does not exist 
[INFO] 1 error 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 6.252 s 
[INFO] Finished at: 2016-09-16T16:01:57+05:30 
[INFO] Final Memory: 18M/152M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on 
project SampleProject: Compilation failure 
[ERROR] /C:/Users/Shashank_bisht/workspace/SampleProject/src/main/java/tiger/Marketing/CreateLeadPage.java:[8,4 
7] package tiger.SampleProject.MyHomepageTestCases does not exist 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

答えて

0

エラーログに基づいて、このクラスがソースコードの一部として存在しない可能性があるため、CreatingLeadPage.javaがtiger.SampleProject.MyHomepageTestCasesクラスをインポートしようとしているようです。 このクラスファイルを追加してコードをコンパイルする必要があります。

+0

私はsrc/main/javaとsrc/test/javaという2つのフォルダを持っていますが、mavenはsrc/main/javaに、src/test/javaにはありません。どのようにsrc/main/javaに行くのではなく、テストクラスを実行するためにmavenを指し示すのですか?ちょうど私が上記のフォルダ構造の画像を追加しました。plsは上の画像を参照してください。 –

関連する問題