java - Maven 包装器生命周期失败
问题描述
当我尝试使用 Intellij 的终端进行 Maven 构建时,我遇到了错误。
只是不确定要做什么或问题是什么。相同的配置适用于早期的 springboot 项目。
错误信息:
D:\springboot\api\streetapiservice>mvnw clean install
The system cannot find the path specified.
'B' is not recognized as an internal or external command,
operable program or batch file.
The directory name is invalid.
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At line:1 char:282
+ ... pe]::Tls12; $webclient.DownloadFile('https://repo.maven.apache.org/ma ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
POM 文件 下面是 pom 文件——我已经删除了一些依赖项。这是使用 spring starter 创建的。
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.api</groupId>
<artifactId>streetapiservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>streetapiservice</name>
<description>Api for handling calls street api</description>
<properties>
<java.version>1.8</java.version>
<sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
<mock-sever-netty-version>3.10.8</mock-sever-netty-version>
<apache-http-version>4.4.1</apache-http-version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
解决方案
- 当我尝试通过 git bash 运行相同的代码时,它运行良好。
- 问题似乎与 IDE 有关
- 重新导入项目解决了这个问题
推荐阅读
- android - android中的app:tint和android:tint有什么区别?
- jquery - 启用平滑滚动而不是捕捉到图像时,光滑的轮播箭头不起作用
- r - R中具有两路方差分析的分类协变量
- c# - WCF Windows 窗体不能在 .exe 中工作,但在 Visual Studio 中工作
- python - 当我尝试运行 2 个从另一个提供和获取数据并且一个正在读取串行端口数据的 python 脚本时,怎么会出现权限错误?
- azure - 当我在 Azure 应用服务中部署 Azure Web 作业时,由于退出代码 -532462766 而失败
- r - 在 Windows 机器上的 Rstudio 中使用 install_github 安装包“cindex”时出错
- javascript - 为什么函数上没有括号
- java - 错误:RuntimeException 并且无法在 Android Studio 上获取 FirebaseDatabase 实例
- python - 当图像已经属于 AWS 链接时,如何在 Colab / AWS ML 实例上下载图像以用于 ML 目的