如何解决IntelliJ中Spring Boot项目的Maven Surefire插件错误-无法执行目标

时间:2019-05-03 17:51:29

标签: maven intellij-idea pom.xml maven-surefire-plugin

我是一位继承了spring / maven项目的前端开发人员。我对属性文件进行了一些小更新,以指向新的数据库,并且需要重新打包项目并将其转换为jar文件。

我的项目进行了验证和编译。但是,当我尝试运行Maven程序包时,出现错误,无法解决。 (下面是完整的错误和POM文件)-无法在项目onlinereviewtool上执行目标org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test(默认测试):无法生成类路径

除了在尝试解决此问题时学到的东西以外,我没有Java或使用Maven的经验。

我尝试按照错误中的链接进行操作,并找到404文件未找到错误。我也曾尝试访问mvnrepository.com-但是由于我对Java或Maven的缺乏了解,因此不确定是否要更新。我也尝试过运行mvndependency :: tree-但无法使其运行(“ mvn”未被识别为内部或外部命令,可操作程序或批处理文件)。

任何见解-甚至是正确方向的观点-也将不胜感激!

[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ onlinereviewtool ---
Downloading: https://repo.spring.io/snapshot/org/apache/maven/surefire/surefire-junit4/2.22.1/surefire-junit4-2.22.1.pom
Downloading: https://repo.spring.io/milestone/org/apache/maven/surefire/surefire-junit4/2.22.1/surefire-junit4-2.22.1.pom
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.22.1/surefire-junit4-2.22.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2019-05-03T10:20:41-07:00
[INFO] Final Memory: 25M/266M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project onlinereviewtool: Unable to generate classpath: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information for org.apache.maven.surefire:surefire-junit4:jar:2.22.1: Failed to retrieve POM for org.apache.maven.surefire:surefire-junit4:jar:2.22.1: Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.22.1 from/to spring-snapshots (https://repo.spring.io/snapshot): Connect to repo.spring.io:443 [repo.spring.io/35.241.58.96] failed: Connection timed out: connect
[ERROR] org.apache.maven.surefire:surefire-junit4:jar:2.22.1
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR] spring-snapshots (https://repo.spring.io/snapshot, releases=true, snapshots=true),
[ERROR] spring-milestones (https://repo.spring.io/milestone, releases=true, snapshots=false),
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] -> [Help 1]
...
Process finished with exit code 1

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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.group</groupId>
<artifactId>onlinereviewtool</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>onlinereviewtool</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.BUILD-SNAPSHOT</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.ldap</groupId>
        <artifactId>spring-ldap-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-ldap</artifactId>
    </dependency>
    <dependency>
        <groupId>com.unboundid</groupId>
        <artifactId>unboundid-ldapsdk</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-test-autoconfigure</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.thymeleaf.extras</groupId>
        <artifactId>thymeleaf-extras-springsecurity3</artifactId>
        <version>3.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>5.1.0.BUILD-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>6.2.2.jre8</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains</groupId>
        <artifactId>annotations</artifactId>
        <version>16.0.2</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

<build>
    <finalName>OnlineReviewApp</finalName>
    <plugins>
        <plugin>
            <configuration>
                <executable>true</executable>
            </configuration>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>

    </plugins>
    <extensions>
        <!-- Enabling the use of FTP -->
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ftp</artifactId>
            <version>1.0-beta-6</version>
        </extension>
    </extensions>
</build>

<!--<distributionManagement>-->
<!--<repository>-->
<!--<id>CRNTACMDEV01</id>-->
<!--<url>ftp://131.198.57.220/</url>-->
<!--</repository>-->
<!--</distributionManagement>-->

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>https://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>https://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>https://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

0 个答案:

没有答案