我对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,所以告诉我是否应该给出其他细节。谢谢!
EDIT:我删除了存储库部分,仍然相同。我将artefactID编辑为docx4j,仍然相同。
只需删除已定义的存储库部分。您既不需要定义本地存储库,因为它仍然在settings.xml Maven配置中定义,也不需要将项目依赖项放在src/main/resources下。
可能是你在"离线模式"下运行Maven吗?查看Netbeans首选项-> Java -> Maven和运行配置,如果有"-o"参数。