2017-08-03 123 views
0

我想为我的scala maven项目的黄瓜BDD测试,我试图添加在intellij添加罐子的依赖项,但由于未知的原因,我无法导入黄瓜包装由import报表。 MY POMmaven-scala BDD测试与maven

<?xml version="1.0" encoding="UTF-8"?> 
     <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns="http://maven.apache.org/POM/4.0.0" 
     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> 

    <parent> 
     <groupId>org.cuke</groupId> 
     <artifactId>xdq</artifactId> 
     <version>0.1.0</version> 
    </parent> 
    <artifactId>cuke-test</artifactId> 
    <dependencies> 
     <dependency> 
      <groupId>org.json4s</groupId> 
      <artifactId>json4s-native_2.11</artifactId> 
      <version>3.5.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.scala-lang</groupId> 
      <artifactId>scala-library</artifactId> 
      <version>2.11.8</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.spark</groupId> 
      <artifactId>spark-core_2.11</artifactId> 
      <version>2.0.2</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.spark</groupId> 
      <artifactId>spark-sql_2.11</artifactId> 
      <version>2.0.2</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.spark</groupId> 
      <artifactId>spark-hive_2.11</artifactId> 
      <version>2.0.2</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.databricks</groupId> 
      <artifactId>spark-csv_2.11</artifactId> 
      <version>1.4.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.json</groupId> 
      <artifactId>json</artifactId> 
      <version>20160810</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.logging.log4j</groupId> 
      <artifactId>log4j-core</artifactId> 
      <version>2.8.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.exadatum</groupId> 
      <artifactId>json-generator</artifactId> 
      <version>0.1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-junit</artifactId> 
      <version>1.2.4</version> 

     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-core</artifactId> 
      <version>1.2.4</version> 

     </dependency> 
     <dependency> 
      <groupId>org.scalatest</groupId> 
      <artifactId>scalatest_2.11</artifactId> 
      <version>3.0.3</version> 

     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-scala_2.11</artifactId> 
      <version>1.2.4</version> 
     </dependency> 


    </dependencies> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-shade-plugin</artifactId> 
       <executions> 
        <!-- Run shade goal on package phase --> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>shade</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <filters> 
         <filter> 
          <artifact>*:*</artifact> 
          <excludes> 
           <exclude>META-INF/*.SF</exclude> 
           <exclude>META-INF/*.DSA</exclude> 
           <exclude>META-INF/*.RSA</exclude> 
          </excludes> 
         </filter> 
        </filters> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>build-helper-maven-plugin</artifactId> 
       <extensions>true</extensions> 
       <executions> 
        <execution> 
         <id>attach-azkaban-job-artifact</id> 
         <phase>package</phase> 
         <goals> 
          <goal>attach-artifact</goal> 
         </goals> 
         <configuration> 
          <artifacts> 
           <artifact> 
            <file>${project.build.directory}/${project.artifactId}.job</file> 
            <type>job</type> 
           </artifact> 
          </artifacts> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>com.exadatum.sensorium.maven</groupId> 
       <artifactId>template-maven-plugin</artifactId> 
       <version>1.0.1</version> 
       <executions> 
        <execution> 
         <id>generate-azkaban-job-file</id> 
         <phase>generate-resources</phase> 
         <goals> 
          <goal>generate</goal> 
         </goals> 
         <configuration> 
          <outputFileName>${project.artifactId}.job</outputFileName> 
          <template>azkaban-job.vm</template> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <executions> 
        <execution> 
         <id>module-assembly</id> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
         <configuration> 
          <appendAssemblyId>false</appendAssemblyId> 
          <descriptors> 

           <descriptor> 
            ${multi.module.project.root.dir}/libraries/common/src/main/resources/assemblies/module-tar-assembly.xml 
           </descriptor> 
          </descriptors> 
          <!--<tarLongFileMode>posix</tarLongFileMode>--> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>net.alchim31.maven</groupId> 
       <artifactId>scala-maven-plugin</artifactId> 
       <version>3.2.0</version> 
       <configuration> 
        <checkMultipleScalaVersions>false</checkMultipleScalaVersions> 
        <recompileMode>modified-only</recompileMode> 
        <useZincServer>false</useZincServer> 
        <scalaVersion>2.11.8</scalaVersion> 
       </configuration> 
       <executions> 
        <execution> 
         <id>scala-compile-first</id> 
         <phase>process-resources</phase> 
         <goals> 
          <goal>add-source</goal> 
          <goal>compile</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.2</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

让我知道我在哪里做错事 我试图创建斯卡拉类以及ScalaDsl延伸,但它不会解决。

回答

1

创建了一个空的scala项目并添加了maven。复制你的pom.xml并删除<parent><\parent>以及<artifactId>cuke-test</artifactId>。还有其他的依赖问题,但是再次,我不知道你的项目结构。

在此之后,我创建一个类:

import cucumber.api.scala.ScalaDsl 

class TestClass extends ScalaDsl { 

} 

和进口的作品。

查看关于<parent>和pom的更多信息,例如project/pom.xml和herehere

希望你得到它的工作。