我建立了新的Cucumber Maven项目。
当我运行我的Runner.java文件与选项运行为Junit,同样工作正常。但是当我尝试使用命令“mvn全新安装”通过命令提示符运行相同的内容时,它会抛出错误:-
C:\Users\HT1\workspace\com.pvrcucumber>mvn clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for PVR_CUCUMBER:com.pvrcucumber:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.microsoft.sqlserver:sqljdbc4:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/config/sqljdbc4.jar will be unresolvable by dependent projects @ line 69, column 16
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 108, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building com.pvrcucumber 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ com.pvrcucumber ---
[INFO] Deleting C:\Users\HT1\workspace\com.pvrcucumber\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ com.pvrcucumber ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 16 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ com.pvrcucumber ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 24 source files to C:\Users\HT1\workspace\com.pvrcucumber\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[5,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[10,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[11,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[19,76] cannot find symbol
symbol: class FindFailed
location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/DealsExclusives.java:[7,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/DealsExclusives.java:[36,91] cannot find symbol
symbol: class FindFailed
location: class stepdefinitions.DealsExclusives
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[14,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[15,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[16,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[66,76] cannot find symbol
symbol: class FindFailed
location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[21,17] cannot find symbol
symbol: class Screen
location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[21,35] cannot find symbol
symbol: class Screen
location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[22,17] cannot find symbol
symbol: class Pattern
location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[22,34] cannot find symbol
symbol: class Pattern
location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[94,27] cannot find symbol
symbol: class Screen
location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[94,45] cannot find symbol
symbol: class Screen
location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[95,27] cannot find symbol
symbol: class Pattern
location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[95,44] cannot find symbol
symbol: class Pattern
location: class pageObject.DealsExclusivesPage
[INFO] 18 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.447 s
[INFO] Finished at: 2016-08-23T13:59:43+05:30
[INFO] Final Memory: 19M/225M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project com.pvrcucumber: Compilation failure: Compilation failure:
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[5,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[10,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[11,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[19,76] cannot find symbol
[ERROR] symbol: class FindFailed
[ERROR] location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/DealsExclusives.java:[7,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/DealsExclusives.java:[36,91] cannot find symbol
[ERROR] symbol: class FindFailed
[ERROR] location: class stepdefinitions.DealsExclusives
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[14,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[15,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[16,25] package org.sikuli.script does not exist
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[66,76] cannot find symbol
[ERROR] symbol: class FindFailed
[ERROR] location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[21,17] cannot find symbol
[ERROR] symbol: class Screen
[ERROR] location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[21,35] cannot find symbol
[ERROR] symbol: class Screen
[ERROR] location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[22,17] cannot find symbol
[ERROR] symbol: class Pattern
[ERROR] location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/stepdefinitions/Cinemas.java:[22,34] cannot find symbol
[ERROR] symbol: class Pattern
[ERROR] location: class stepdefinitions.Cinemas
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[94,27] cannot find symbol
[ERROR] symbol: class Screen
[ERROR] location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[94,45] cannot find symbol
[ERROR] symbol: class Screen
[ERROR] location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[95,27] cannot find symbol
[ERROR] symbol: class Pattern
[ERROR] location: class pageObject.DealsExclusivesPage
[ERROR] /C:/Users/HT1/workspace/com.pvrcucumber/src/main/java/pageObject/DealsExclusivesPage.java:[95,44] cannot find symbol
[ERROR] symbol: class Pattern
[ERROR] location: class pageObject.DealsExclusivesPage
[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
我的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>PVR_CUCUMBER</groupId>
<artifactId>com.pvrcucumber</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>com.pvrcucumber</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-testng -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.sikuli</groupId>
<artifactId>sikuli-api</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/config/sqljdbc4.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
当我跑步的时候。通过Runas的java类-
请建议!!
右键单击项目 -
解决方案:@在构建组件之前(使用mvn clean install)。一次构建整个项目,然后再次构建组件
为什么如此:我多次遇到这个错误。大多数时候,我会尝试单独构建组件(因为我在其他地方没有做任何更改)。
没错,但最近下载的额外jar可能会受到第三方(组件内部)所做更改的影响。在整个项目上进行完整的mvn干净安装使我节省了很多时间
运行mvn clean安装时,编译项目所需的所有内容都必须在pom文件的依赖项部分中定义。运行junit时,编译项目所需的所有内容都必须在类路径中定义。
在这种情况下,可以在 junit 的类路径上找到包组织 sikuli.script,但在 maven 依赖项中找不到该脚本。
要解决这个问题,您必须在pom文件中添加一个maven依赖项,这个POM文件包含maven工件(通常是一个jar文件),这个工件包含丢失的包。
找到包含丢失包的jar后(尝试查找junit的runner类路径),可以将jar添加到本地maven存储库中,以创建工件,然后将其包含在pom文件中。尝试搜索“How to add jar to local maven repo”以了解如何执行此操作的语法。
你好自从我第一次尝试运行命令“mvn clean install”以来,一直出现此错误: [INFO]构建失败[INFO] - [INFO]总时间:41.009 s [INFO]完成时间:2022-09-24t 11:12:43-03:00[INFO]-[ERROR]未能执行目标org . Apache . maven . plugins:maven-compiler-plugin:3 . 8 .
我是学习java编程的新手!我想在一个maven项目中制作一个. jar。运行此命令< code>mvn全新安装后,我收到以下错误消息: 无法执行目标org.apache.maven.plugins: maven-compiler-plugin: 2.3.2: compile(default-compile)on project wps-demo:编译失败 在C:\Program Files\Ja
我在2个项目中运行JUnit 5测试。在一个项目中,相同的设置是工作正常的,测试运行没有问题。 在另一个项目中,我总是遇到以下编译错误。这些依赖项添加到PoM文件中,当从eclipse运行时,测试运行不会出错。只是mvn清理安装失败。我查看了各种帖子,寻找类似的错误,但这并没有解决我的问题。任何线索都会非常有用。在其他项目中,相同的pom文件工作得非常好。 错误:无法执行目标组织。阿帕奇。专家插件
我是学习java编程的新手!我想在maven项目中制作一个。jar。在运行此命令后,我将得到以下错误消息:
问题内容: 我在主软件包的一个目录下有一些文件: main.go config.go server.go 当我这样做时:“执行构建”程序将完美构建并运行良好。当我这样做时:“ go run main.go”失败了。 输出: 未定义的符号是结构,并且大写,因此应将其导出。 我的Go版本:go1.1.2 linux / amd64 问题答案: 这应该工作 Go run需要一个文件或多个文件,并且它仅合
1.2 编译运行 1.2.1 创建项目 package main import ( "github.com/henrylee2cn/pholcus/exec" // "github.com/henrylee2cn/pholcus/logs" _ "github.com/pholcus/spider_lib" // 此为公开维护的spider规则库 // _ "spi