【问题标题】:Maven Wrapper Lifecycle failingMaven 包装器生命周期失败
【发布时间】:2021-09-23 07:58:05
【问题描述】:

当我尝试使用 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>

【问题讨论】:

  • 你可以试试mvnw clean install -e
  • 你能和我们分享一下 pom 文件和完整的异常堆栈跟踪吗……这里没有定论。添加尽可能多的详细信息,并包括您尝试过的事情。
  • @AbhishekDhoundiyal 即使使用 -e 它也会返回相同的错误消息
  • 我非常想看看当您复制项目并从 real运行绝对是 real Maven 时会发生什么> 终端(cmd.exe)就可以了
  • 哈——这就是适合你的 IDE ;)

标签: java spring-boot maven pom.xml


【解决方案1】:
  • 当我尝试通过 git bash 运行相同的代码时,它运行良好。
  • 问题似乎与 IDE 有关
  • 重新导入项目解决了这个问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-27
    • 2012-11-22
    • 1970-01-01
    • 2014-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多