简体   繁体   English

没有互联网连接,Maven无法执行目标

[英]Maven failed to execute goal without internet connection

I'm trying to get a Maven build working for a Java project, with the rather interesting caveat that the machine I'm building on does not have, and cannot have, access to the Maven repository. 我试图使一个Maven构建适用于Java项目,但有一个非常有趣的警告,即我所构建的计算机没有访问权限,也不能访问Maven存储库。

The error I'm getting with any of the Lifecycle processes I try and run is 我尝试运行的任何生命周期流程遇到的错误是

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project xxxxxx: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Cannot access central ( https://repo.maven.apache.org/maven2 ) in offline mode and the artifact org.codehaus.plexus:plexus-utils:jar:1.1 has not been downloaded from it before. 无法在项目xxxxxx上执行目标org.apache.maven.plugins:maven-clean-plugin:2.5:clean(默认清除):执行目标org.apache.maven.plugins:maven-clean-plugin的默认清除: 2.5:清理失败:插件org.apache.maven.plugins:maven-clean-plugin:2.5或其依赖项之一无法解析:无法访问中央( https://repo.maven.apache.org/maven2 )脱机模式,并且之前从未从其下载工件org.codehaus.plexus:plexus-utils:jar:1.1。 -> [Help 1] -> [帮助1]

Because of the disconnected nature of the machine I'm working on, I've had to have the Maven build tool manually downloaded for me, and from the error messages I've been receiving, I've also had the relevant plugins manually downloaded ( maven-clean-plugin-2.5.jar for example), but I'm having trouble figuring out where to put the plugins manually so Maven can pick them up and work with them. 由于我正在使用的机器具有断开连接的特性,因此必须为我手动下载Maven构建工具,并且从收到的错误消息中,我还手动下载了相关的插件(例如, maven-clean-plugin-2.5.jar ),但我在弄清楚手动将插件放置在何处时遇到麻烦,因此Maven可以选择并使用它们。

This looks like locked directory. 这看起来像是锁定目录。 Are you sure the process you are trying to build is not running, and no external program is using the project directory. 您确定要构建的进程没有运行,并且没有外部程序在使用项目目录吗?

Try removing the target directory manually. 尝试手动删除目标目录。

Edit: Ok, so it's actually a problem with remote maven repository. 编辑:好的,所以这实际上是远程Maven存储库的问题。

Have you tried configuring a custom maven repo 您是否尝试过配置自定义Maven存储库

<project>
  ...
  <repositories>
    <repository>
      <id>my-internal-site</id>
      <url>http://myserver/repo</url>
    </repository>
  </repositories>
  ...
</project>

More info here 更多信息在这里

Yes. 是。 It looks like maven is not able to delete the working directory. 看来maven无法删除工作目录。 Check if any process locking your directory. 检查是否有任何进程锁定了您的目录。 Else delete it manually. 否则,请手动将其删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM