当前位置: 首页 > 知识库问答 >
问题:

在central中找不到工件JUnit:JUnit:Jar:4.12

朱高超
2023-03-14
Intranet                           |      Internet
---------------------------------------------------------------------
client <------> Artifactory <------|----> Remote repository: jcenter
mvn clean package -U

以下部分产出:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://my-own-server:8081/artifactory/libs-release/junit/junit/4.12/junit-4.12.pom
Downloaded: http://my-own-server:8081/artifactory/libs-release/junit/junit/4.12/junit-4.12.pom (24 KB at 164.0 KB/sec)
Downloading: http://my-own-server:8081/artifactory/libs-release/com/oracle/ojdbc7/12.1.0.1/ojdbc7-12.1.0.1.pom
[WARNING] The POM for com.oracle:ojdbc7:jar:12.1.0.1 is missing, no dependency information available
Downloading: http://my-own-server:8081/artifactory/libs-release/junit/junit/4.12/junit-4.12.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.484s
[INFO] Finished at: Thu Feb 25 17:19:01 EET 2016
[INFO] Final Memory: 8M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project com.company:MyProject:war:0.0.1-SNAPSHOT: Could not find artifact junit:junit:jar:4.12 in central (http://my-own-server:8081/artifactory/libs-release) -> [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

我怎样才能解决这个问题?

>

  • Artifactory和远程存储库之间的连接起作用。

      null
      null
    mvn clean package -U -X
    
    ...
    Downloading: http://my-own-server:8081/artifactory/libs-release/junit/junit/4.12/junit-4.12.jar
    [DEBUG] Writing resolution tracking file C:\Users\first.last\.m2\repository\junit\junit\4.12\junit-4.12.jar.lastUpdated
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.903s
    [INFO] Finished at: Thu Feb 25 17:25:51 EET 2016
    [INFO] Final Memory: 9M/155M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project com.company:MyProject:war:0.0.1-SNAPSHOT: Could not find artifact junit:junit:jar:4.12 in central (http://my-own-server:8081/artifactory/libs-release) -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project MyProject: Could not resolve dependencies for project com.company:MyProject:war:0.0.1-SNAPSHOT: Could not find artifact junit:junit:jar:4.12 in central (http://my-own-server:8081/artifactory/libs-release)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
            at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:497)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.company:MyProject:war:0.0.1-SNAPSHOT: Could not find artifact junit:junit:jar:4.12 in central (http://my-own-server:8081/artifactory/libs-release)
            at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:189)
            at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185)
            ... 22 more
    Caused by: org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact junit:junit:jar:4.12 in central (http://my-own-server:8081/artifactory/libs-release)
            at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:375)
            at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:183)
            ... 23 more
    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact junit:junit:jar:4.12 in central (http://my-own-server:8081/artifactory/libs-release)
            at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
            at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
            at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:358)
            ... 24 more
    Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact junit:junit:jar:4.12 in central (http://my-own-server:8081/artifactory/libs-release)
            at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
            at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
            at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
            at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)
    [ERROR]
    [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
    

    如果我在http://my-own-server:8081/artifactory/webapp/#/artifacts/browse/tree/general/libs-release-local中手动上传junit-4.12.jar文件,它可以工作,但我希望只为不在官方远程存储库中的文件保留该文件夹(如ojdbc7.jar)。

    以下URL http://my-own-server:8081/artifactory/libs-release/junit/junit/4.12/junit-4.12.jar?trace包含:

    Request ID: ...
    Repo Path ID: libs-release:junit/junit/4.12/junit-4.12.jar
    Method Name: GET
    User: admin
    Time: 2016-02-25T18:02:35.664+02:00
    Thread: http-nio-8081-exec-346
    Steps: 
    2016-02-25T18:02:35.664+02:00 Received request
    2016-02-25T18:02:35.664+02:00 Request source = <ip>, Last modified = 01-01-70 01:59:59 +02:00, If modified since = -1, Thread name = http-nio-8081-exec-346
    2016-02-25T18:02:35.664+02:00 Executing any BeforeDownloadRequest user plugins that may exist
    2016-02-25T18:02:35.664+02:00 Retrieving info
    2016-02-25T18:02:35.664+02:00 Consulting the virtual repo download strategy
    2016-02-25T18:02:35.664+02:00 Trying to retrieve resource info from the local storage
    2016-02-25T18:02:35.664+02:00 Unable to find resource in libs-release:junit/junit/4.12/junit-4.12.jar
    2016-02-25T18:02:35.664+02:00 Searching for info in aggregated repositories
    2016-02-25T18:02:35.664+02:00 Preparing list of aggregated repositories to search in
    2016-02-25T18:02:35.664+02:00 Appending the virtual repository 'libs-release'
    2016-02-25T18:02:35.664+02:00 Appending the virtual repository 'libs-release'
    2016-02-25T18:02:35.664+02:00 Appending the virtual repository 'libs-release'
    2016-02-25T18:02:35.664+02:00 Appending collective local repositories
    2016-02-25T18:02:35.664+02:00 Appending collective local cache repositories
    2016-02-25T18:02:35.664+02:00 Appending collective remote repositories
    2016-02-25T18:02:35.664+02:00 Intercepting info request with 'MavenMetadataInterceptor'
    2016-02-25T18:02:35.664+02:00 Intercepting info request with 'PomInterceptor'
    2016-02-25T18:02:35.664+02:00 Processing request as a release resource
    2016-02-25T18:02:35.664+02:00 Searching for the resource within libs-release-local
    2016-02-25T18:02:35.664+02:00 Unable to find resource in libs-release-local:junit/junit/4.12/junit-4.12.jar
    2016-02-25T18:02:35.664+02:00 Searching for the resource within ext-release-local
    2016-02-25T18:02:35.664+02:00 Unable to find resource in ext-release-local:junit/junit/4.12/junit-4.12.jar
    2016-02-25T18:02:35.664+02:00 Searching for the resource within jcenter-cache
    2016-02-25T18:02:35.664+02:00 Unable to find resource in jcenter-cache:junit/junit/4.12/junit-4.12.jar
    2016-02-25T18:02:35.664+02:00 Searching for the resource within jcenter
    2016-02-25T18:02:35.664+02:00 Returning an unfound resource
    2016-02-25T18:02:35.664+02:00 Requested resource is found = false
    2016-02-25T18:02:35.664+02:00 Request is HEAD = false
    2016-02-25T18:02:35.664+02:00 Request is for a checksum = false
    2016-02-25T18:02:35.664+02:00 Target repository is not remote or doesn't store locally = true
    2016-02-25T18:02:35.664+02:00 Requested resource was not modified = false
    2016-02-25T18:02:35.664+02:00 Responding with unfound resource
    2016-02-25T18:02:35.664+02:00 Setting default response status to '404' reason to 'Resource not found'
    2016-02-25T18:02:35.664+02:00 Response is an instance of UnfoundRepoResourceReason
    2016-02-25T18:02:35.664+02:00 Configured to hide un-authorized resources = false
    2016-02-25T18:02:35.664+02:00 Original response status is auth related = false
    2016-02-25T18:02:35.664+02:00 Using original response status of '404' and message 'Could not find resource'
    2016-02-25T18:02:35.664+02:00 Sending error with status 404 and message 'Could not find resource'
    2016-02-25T18:02:35.664+02:00 Executing any AfterDownloadErrorAction user plugins that may exist
    2016-02-25T18:02:35.664+02:00 Response code wasn't modified by the user plugins
    2016-02-25T18:02:35.664+02:00 Sending response with the status '404' and the message 'Could not find resource'
    

    我的pom.xml包含:

    <dependencies>
        <!-- JUnit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        ...
    </dependencies>
    
    • ArtiFactory版本4.5.1
    • Apache Maven 3.0.5
  • 共有1个答案

    田佐
    2023-03-14

    看起来Artifactory在jcenter-cache中缓存了一个丢失的检索。如果Artifactory由于某种原因(例如超时)未能从JCenter获取junit,它将在远程存储库的“Missed Retrieval cache period”属性中配置的期间内缓存此失败。
    您可以清除此错误,并通过关闭缓存强制Artifactory尝试再次检索工件。

    适用于这种情况:

    >

  • 转到工件>工件存储库浏览器>jcenter-cache>JUnit/JUnit>4.12

    或者只需点击

    http://my-own-server:8081/artifactory/webapp/#/artifacts/browse/tree/general/jcenter-cache/junit/junit/4.12

    右键单击4.12>Zap缓存:

  •  类似资料:
    • 我有一个带有组类型存储库的Nexus服务器,其中包含Maven Center。我可以在Maven Center[1]中看到org.codehaus.mojo:cobertura-maven-plugin:2.5.1工件(包括pom和jar),但是当我试图使用Maven下载这个工件时,它说: 你知道为什么它不能下载工件吗? UPD:是的,我在settings.xml中设置了镜像,是的,存储库是“在服

    • 问题内容: 对于Maven Central(或任何其他给定的Nexus存储库)上的工件,我想列出所有直接依赖项。 最初,我考虑过只阅读pom.xml并从依赖项部分收集所有条目。但是我注意到这些条目可能没有版本(由依赖管理提供),或者这些条目可能来自父poms。 我的第二个想法是建立某种人造Maven项目并使用收集相关性。这可能变得复杂。 什么是最直接(也是可靠)的方法? 问题答案: 在Maven插

    • 我把我的Mac OS从Sierra升级到了Catalina。从那以后,我的工作环境就被打破了。当我在本地运行时,我得到了这个错误- 无法执行目标org.codehaus.mojo:aspectj-maven-plugin:1.9:对项目SIPStack执行目标org.codehaus.mojo:aspectj-maven-plugin:1.9:编译失败:Plugin org.codehaus.mo

    • 我正在尝试构建 maven 项目,但工作不正常。 这是我的POM.xml setting.xml 错误 [错误]插件 org.apache.maven.plugins:maven-compiler-plugin:3.1 或其依赖项之一无法解析:无法读取 org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 的工件描述符:无法传输工件 org.

    • 问题内容: 背景:我正在封闭网络中的Maven项目,这意味着我无法连接到Maven Central。我有一个存储库文件夹,其中包含我需要的所有工件,包括插件和Maven工件。另外,我无法使用或安装Nexus。 问题:我想使用maven 3.6.0 / jdk 1.8.0_162运行Jenkins作业。我的settings.xml文件如下: 我的POM没有存储库部分,因为jenkins从属服务器应确

    • 问题内容: 在IntelliJ中,当我尝试编译时出现此奇怪的错误。 我知道,问题出在哪里很明显,但是花了太多时间在这个问题上,我现在把信任交给您! 我使用ideaCommunity-9,在其中为JBoss创建了一个全局库,其中包含所有JBoss jar,包括ejb3-persistence.jar。我的模块包含此库,并且已将其移至依赖关系的顶部。在类路径中,没有其他地方有javax.persist