Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 黄瓜皮容器未注册_Java_Maven_Cucumber_Picocontainer - Fatal编程技术网

Java 黄瓜皮容器未注册

Java 黄瓜皮容器未注册,java,maven,cucumber,picocontainer,Java,Maven,Cucumber,Picocontainer,我经历了与相同的情况,但建议的解决方案都不适合我。基本上,我已经下载了。它运行良好。然后,我将SearchSteps模块分为两部分-一部分包含@Before和@After语句,另一部分包含步骤(因为我打算重用初始化代码)。我已经在我的pom.xml中添加了对Cumber picocontainer的依赖项 我得到了与上面问题相同的错误:class com.browserstack.stepdefs.SearchSteps没有空构造函数。如果需要DI,请将cucumber picocontaine

我经历了与相同的情况,但建议的解决方案都不适合我。基本上,我已经下载了。它运行良好。然后,我将SearchSteps模块分为两部分-一部分包含
@Before
@After
语句,另一部分包含步骤(因为我打算重用初始化代码)。我已经在我的
pom.xml
中添加了对Cumber picocontainer的依赖项

我得到了与上面问题相同的错误:
class com.browserstack.stepdefs.SearchSteps没有空构造函数。如果需要DI,请将cucumber picocontainer放在类路径上
。我已经尝试了所有建议的解决方案,但错误依然存在

我的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>com.browserstack</groupId>
    <artifactId>cucumber-jvm-java-browserstack</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>cucumber-jvm-java-browserstack</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <cucumber.jvm.parallel.version>2.2.0</cucumber.jvm.parallel.version>
        <surefire.maven.plugin.version>2.19.1</surefire.maven.plugin.version>
        <acceptance.test.parallel.count>1</acceptance.test.parallel.count>
    </properties>

    <dependencies>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.5</version>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.5</version>
        </dependency>

        <dependency>
            <groupId>org.picocontainer</groupId>
            <artifactId>picocontainer</artifactId>
            <version>2.14.3</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.0.1</version>
            <scope>test</scope>
        </dependency>

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

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>

        <dependency>
            <groupId>com.browserstack</groupId>
            <artifactId>browserstack-local-java</artifactId>
            <version>1.0.1</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <id>acceptance-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <forkCount>${acceptance.test.parallel.count}</forkCount>
                            <reuseForks>true</reuseForks>
                            <includes>
                                <include>**/*IT.class</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <!-- here the phase you need -->
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/test-classes/com/yourcompany/cucumberjvm</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/test/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.temyers</groupId>
                <artifactId>cucumber-jvm-parallel-plugin</artifactId>
                <version>${cucumber.jvm.parallel.version}</version>
                <executions>
                    <execution>
                        <id>generateRunners</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>generateRunners</goal>
                        </goals>
                        <configuration>
                            <!-- Mandatory -->
                            <!-- comma separated list of package names to scan for glue code -->
                            <glue>com.browserstack.stepdefs</glue>
                            <!-- These are the default values -->
                            <!-- Where to output the generated Junit tests -->
                            <outputDirectory>${project.build.directory}/generated-test-sources/features</outputDirectory>
                            <!-- The diectory containing your feature files.  -->
                            <featuresDirectory>src/test/java/resources/features</featuresDirectory>
                            <cucumberOutputDir>${project.build.directory}/cucumber_reports/test_results</cucumberOutputDir>
                            <!-- comma separated list of output formats -->
                            <format>junit</format>
                            <!-- CucumberOptions.strict property -->
                            <strict>true</strict>
                            <!-- CucumberOptions.monochrome property -->
                            <monochrome>true</monochrome>
                            <!-- The tags to run, maps to CucumberOptions.tags property -->
                            <tags>"~@ignore"</tags>

                            <namingScheme>pattern</namingScheme>
                            <!-- The class naming pattern to use.  Only required/used if naming scheme is 'pattern'.-->
                            <namingPattern>{f}_Parallel{c}IT</namingPattern>

                            <!-- If set to true, only feature files containing the required tags shall be generated. -->
                            <!-- Excluded tags (~@notMe) are ignored. -->
                            <filterFeaturesByTags>true</filterFeaturesByTags>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
com.browserstack
java浏览器堆栈
0.0.1-快照
罐子
java浏览器堆栈
http://maven.apache.org
UTF-8
2.2.0
2.19.1
1.
信息杯
黄瓜爪哇
1.2.5
信息杯
黄瓜刺柏
1.2.5
org.picocontainer
微微容器
2.14.3
org.seleniumhq.selenium
硒爪哇
3.0.1
测试
朱尼特
朱尼特
4.12
测试
org.apache.commons
公地io
1.3.2
com.browserstack
browserstack本地java
1.0.1
maven编译器插件
3.3
1.6
1.6
org.apache.maven.plugins
maven surefire插件
${surefire.maven.plugin.version}
验收试验
集成测试
测试
${acceptance.test.parallel.count}
真的
**/*IT.class
maven资源插件
3.0.2
复制资源
验证
复制资源
目标/测试类/com/yourcompany/cucumberjvm
src/测试/资源
真的
com.github.temyers
黄瓜jvm并行插件
${cumber.jvm.parallel.version}
发电商
验证
发电商
com.browserstack.stepdefs
${project.build.directory}/生成的测试源/功能
src/test/java/resources/features
${project.build.directory}/cucumber\u reports/test\u results
朱尼特
真的
真的
“~@忽略”
图案
{f} _并行{c}IT
真的
依赖关系显示在我的项目结构中。我做错了什么


如果需要,很乐意提供所有源代码。

以上@mpkorstanje给出的答案是正确的。依赖项的全文如下,请注意与所有info.cukes工件的版本相同:

<dependency>
   <groupId>info.cukes</groupId>
   <artifactId>cucumber-picocontainer</artifactId>
   <version>1.2.5</version>
</dependency>

信息杯
黄瓜皮容器
1.2.5

用cucumber-pico替换您的pico容器依赖项。谢谢,@mpkorstanje,这很有效。回答如下。