Maven没有下载依赖项:"存储库系统处于脱机状态"

时间:2015-09-15 11:02:44

标签: java maven netbeans

我对Maven感到不舒服,但我设法让它与Netbeans一起工作了一段时间。但突然间,Maven拒绝下载新的依赖项:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project matheos: Could not resolve dependencies for project lecoleopensource:matheos:jar:1.4.4-SNAPSHOT: The repository system is offline but the artifact org.docx4j:docx4j-ImportXHTML:jar:3.2.2 is not available in the local repository.
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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 lecoleopensource:matheos:jar:1.4.4-SNAPSHOT: The repository system is offline but the artifact org.docx4j:docx4j-ImportXHTML:jar:3.2.2 is not available in the local repository.
    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: The repository system is offline but the artifact org.docx4j:docx4j-ImportXHTML:jar:3.2.2 is not available in the local repository.
    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: The repository system is offline but the artifact org.docx4j:docx4j-ImportXHTML:jar:3.2.2 is not available in the local repository.
    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: The repository system is offline but the artifact org.docx4j:docx4j-ImportXHTML:jar:3.2.2 is not available in the local repository.
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:348)
    ... 26 more

有些东西显然是离线的,但我不明白为什么以及如何解决这个问题。

这是我的pom文件的一部分:

    <dependencies>
        <!-- docx4j : converts html to docx -->
        <dependency>
                <groupId>org.docx4j</groupId>
                <artifactId>docx4j</artifactId>
                <version>3.2.2</version>
        </dependency>

        <!-- pdf2dom : converts pdf to html -->
        <!--dependency>
                <groupId>net.sf.cssbox</groupId>
                <artifactId>pdf2dom</artifactId>
                <version>1.3</version>
        </dependency-->


    </dependencies>

我不明白的是它以前一直工作得很好......

我不太了解Maven,所以告诉我是否应该提供其他细节。谢谢!

编辑:我删除了存储库部分,仍然相同。我将artefactID编辑为docx4j,仍然是相同的。

1 个答案:

答案 0 :(得分:5)

只需删除您定义的存储库部分即可。您既不需要定义本地存储库,因为它仍然在settings.xml Maven配置中定义,也不会将项目依赖项放在src / main / resources下。

<强>更新

你是否正在以“离线模式”运行Maven?看看你的Netbeans首选项 - &gt; Java - &gt; Maven和您的运行配置,如果有“-o”参数。