2017-06-11 9 views
0

src/test/javaフォルダに異なるパッケージを使用してキュウリのテストケースを作成し、すべての依存関係とクラスを持つjarファイルを作成します。それはうまくコンパイルされ、うまく動作します。ただし、jarファイルに変換する際には、クラス/依存関係は存在しません。後で私は以下のようにMaven Shade Pluginを使用し、Meta-INFフォルダを取得しました。クラスはありません。 eclipse IDeとMaven 3.3.9、Selenium 2.53を使用しています。mavenを使用してjarファイルのテストクラスを取得できません

maven installの後に2つのjarファイルBsMonitor-0.0.1-SNAPSHOT(たくさんのファイルがありますが、私のクラスファイルはありません)とオリジナルのBsMonitor-0.0.1-SNAPSHOTが得られました。 META-INFフォルダー。

メインクラスのタグの下で、私はメインメソッドを含むクラスを指しています。私はそれが道であるかどうか確信していません。

また、画像に見られるように、src/Main/Javaにはファイルがありませんが、src/test/javaにのみあります。これを進めるには?

マイプロジェクト構造:

enter image description here

マイPOM:ここにMavenによって提案された方法に従って

<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.cucumber</groupId> 
<artifactId>BsMonitor</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<packaging>jar</packaging> 

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

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

<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>info.cukes</groupId> 
     <artifactId>cucumber-java</artifactId> 
     <version>1.2.5</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>info.cukes</groupId> 
     <artifactId>cucumber-picocontainer</artifactId> 
     <version>1.2.5</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>info.cukes</groupId> 
     <artifactId>cucumber-junit</artifactId> 
     <version>1.2.5</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>jdom</groupId> 
     <artifactId>jdom</artifactId> 
     <version>1.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-server</artifactId> 
     <version>2.53.0</version> 
    </dependency> 
    <dependency> 
     <groupId>com.codeborne</groupId> 
     <artifactId>phantomjsdriver</artifactId> 
     <version>1.2.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.sonarsource.sonarlint.core</groupId> 
     <artifactId>sonarlint-core</artifactId> 
     <version>2.2</version> 
    </dependency> 
    <dependency> 
     <groupId>info.cukes</groupId> 
     <artifactId>cucumber-core</artifactId> 
     <version>1.2.5</version> 
    </dependency> 
</dependencies> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.17</version> 
      <configuration> 
       <includes> 
        <include>**/*Test.java</include> 
       </includes> 
      </configuration> 
     </plugin> 
     <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-shade-plugin</artifactId> 
    <version>1.6</version> 
    <executions> 
     <execution> 
     <phase>package</phase> 
     <goals> 
      <goal>shade</goal> 
     </goals> 
     <configuration> 
      <transformers> 
      <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
       <mainClass>com.cucumber.Base.NewMain</mainClass> 
      </transformer> 
      </transformers> 
     </configuration> 
     </execution> 
    </executions> 
    </plugin> 
</plugins> 
</build> 
</project>  
+0

を役に立てば幸いリンクであるあなたは、から構成を削除することができますmaven-surefire-pluginに '**/* Test.java'を含めるには、これは[maven-surefire-plugin]のデフォルトです(http://maven.apache.org/suref ire/maven-surefire-plugin/test-mojo.html#includesを参照してください)。プラグインのバージョンを定義するには、pluginManagementを使用して行う必要があります。特別な理由はありますか?[maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin/)の古いバージョンを使用していますか? – khmarbaise

答えて

関連する問題