【发布时间】:2021-05-05 16:56:13
【问题描述】:
当我编译我的项目时,我得到了错误: “java:包 net.serenitybdd.core.pages 不存在” enter image description here
当我运行项目时,我收到错误: “无法传输工件 org.apache.maven.plugins: maven-enforcer-plugin: pom: 1.4 from / to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo .maven.apache.org / maven2 / org /apache/maven/plugins/maven-enforcer-plugin/1.4/maven-enforcer-plugin-1.4.pom" enter image description here
我的本地 PC 上有同样的项目,它可以正常工作。现在我将它传递到我的工作站,这发生了。 我正在检查,似乎 McAfee-Agent Antivirus 正在阻止它? enter image description here 如果您能帮助我,那就太好了,谢谢。
IDE IntelliJ - Proyecto Maven
这是我的 POM:
4.0.0
<groupId>org.example</groupId>
<artifactId>ToMapfre</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<serenity.version>2.0.54</serenity.version>
<serenity.maven.version>2.0.54</serenity.maven.version>
<serenity.cucumber.version>1.6.4</serenity.cucumber.version>
</properties>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>2.0.54</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-cucumber</artifactId>
<version>${serenity.cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<AlwaysPass/>
</rules>
<fail>true</fail>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<configuration>
<includes>
<include>**/*RunnerTest.java</include>
</includes>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.maven.version}</version>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
【问题讨论】:
-
您使用什么 IDE 版本?确保使用 2021.1.1 版本进行尝试。如果问题仍然存在,请澄清-您可以通过 Maven 从命令行构建吗?附上完整的idea.log file 看看会发生什么。
-
我尝试了这些选项,但得到的信息相同。我一直在检查,我看到在我传递我的项目的远程机器上,IDE 没有库,由于某种原因它没有下载库。有什么理由不这样做吗?我该如何配置它?
-
这个项目的命令行中
mvn clean compile命令的结果是什么?
标签: java maven intellij-idea