spring JAVA MAVEN BUILD失败,无法抑制警告

pcww981p  于 2023-11-16  发布在  Spring
关注(0)|答案(1)|浏览(130)

我用的是maven 3.6.3版
mvn package命令失败,并显示以下错误消息:

[INFO] Scanning for projects...
    
    [INFO]
    
    [INFO] ---------------------< mypdf:mypdf >----------------------
    
    [INFO] Building mypdf 1.0
    
    [INFO] --------------------------------[ war ]---------------------------------
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/commonTools/commonTools/1.0/commonTools-1.0.pom
    
    Warning:  The POM for commonTools:commonTools:jar:1.0 is missing, no dependency information available
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/jakarta-oro/jakarta-oro/2.0.8/jakarta-oro-2.0.8.pom
    
    Warning:  The POM for jakarta-oro:jakarta-oro:jar:2.0.8 is missing, no dependency information available
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/jFdfTk/jFdfTk/1.0/jFdfTk-1.0.pom
    
    Warning:  The POM for jFdfTk:jFdfTk:jar:1.0 is missing, no dependency information available
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/ddchanger/ddchanger/1.0/ddchanger-1.0.pom
    
    Warning:  The POM for ddchanger:ddchanger:jar:1.0 is missing, no dependency information available
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/cwmfa/io/swagger/mfa-swagger-java-client-dm/1.0.0/mfa-swagger-java-client-dm-1.0.0.pom
    
    Warning:  The POM for cwmfa.io.swagger:mfa-swagger-java-client-dm:jar:1.0.0 is missing, no dependency information available
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/commonTools/commonTools/1.0/commonTools-1.0.jar
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/jakarta-oro/jakarta-oro/2.0.8/jakarta-oro-2.0.8.jar
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/jFdfTk/jFdfTk/1.0/jFdfTk-1.0.jar
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/ddchanger/ddchanger/1.0/ddchanger-1.0.jar
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/com/oracle/ojdbc14/10.2.0.2.0/ojdbc14-10.2.0.2.0.jar
    
    Downloading from maven.oracle.com: https://repo1.maven.org/maven2/cwmfa/io/swagger/mfa-swagger-java-client-dm/1.0.0/mfa-swagger-java-client-dm-1.0.0.jar
    
    [INFO] ------------------------------------------------------------------------
    
    [INFO] BUILD FAILURE
    
    [INFO] ------------------------------------------------------------------------
    
    [INFO] Total time:  2.165 s
    
    [INFO] Finished at: 2023-10-26T12:43:04-05:00
    
    [INFO] ------------------------------------------------------------------------
    
    Error:  Failed to execute goal on project mypdf: Could not resolve dependencies for project mypdf:mypdf:war:1.0: The following artifacts could not be resolved: commonTools:commonTools:jar:1.0, jakarta-oro:jakarta-oro:jar:2.0.8, jFdfTk:jFdfTk:jar:1.0, ddchanger:ddchanger:jar:1.0, com.oracle:ojdbc14:jar:10.2.0.2.0, cwmfa.io.swagger:mfa-swagger-java-client-dm:jar:1.0.0: Could not find artifact commonTools:commonTools:jar:1.0 in maven.oracle.com (https://repo1.maven.org/maven2/) -> [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/DependencyResolutionException
    
    Error: Process completed with exit code 1.

字符串
然后,我试图通过在<MAVEN_HOME>\conf\settings.xml中的<profiles>下添加以下内容来抑制错误,但没有帮助。

<profiles>
    
        <profile>
    
            <id>ignore-missing-pom-warnings</id>
    
            <activation>
    
                <activeByDefault>true</activeByDefault>
    
            </activation>
    
            <properties>
    
                <maven.compiler.failOnMissingPom>false</maven.compiler.failOnMissingPom>
    
            </properties>
    
        </profile>
    
        <!-- profile
    
         | Specifies a set of introductions to the build process, to be activated using one or more of the
    
    ….
    
    ……


你能建议我如何在mvn构建过程中解决或抑制警告吗?

ryevplcw

ryevplcw1#

您的项目正在引用不可用的依赖项,这将导致项目失败。您需要找到正确的依赖项或找到替换项。另一个选项是尽可能完全替换依赖于这些依赖项的代码。后者并不总是可行的。
我会做一个有根据的猜测,大多数(如果不是所有的话)这些依赖关系分为两个桶:
1.仅对Maven本地可用的权限。
1.那些在Maven Central的管理人员,有一些是协调的,但从一段时间前就被移动或退休了。
对于1)您需要在构建运行的本地Maven存储库中或Maven存储库中安装这些依赖项。
对于2),您需要搜索依赖项,看看它们是否被移动了,或者使用的版本是否不再可用。在后一种情况下,您可能会找到更新的版本。

相关问题