好的,我在我的 maven webdriver 项目中查看了pom.xml,我认为您应该检查一下:
<!-- Create JAR manifest with main class, but without Maven descriptor, so clients don't see this file -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<mainClass>com.deutscheboerse.test.MyTest</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
在 projet 文件夹中,我在 com.deutscheboerse.test 包下创建了名为 MyTest 的文件(java 类),该类包含 main 方法。代码片段:
public static void main(String[] args) throws Exception {
myTest(args[0], args[1], args[2], price);
}
虽然mytest() 方法很神奇:
public static void myTest(String driver, String login, String password, Price price) throws Exception {
PerfTests tests = new PerfTests(USED_ENVIRONMENT, driver);
tests.login(login, password);
//... and other steps
}
长话短说
检查您的pom.xml 是否包含主类的路径,并且该类实际上包含主方法