【问题标题】:mvn fails on automounted directoriesmvn 在自动挂载的目录上失败
【发布时间】:2017-07-12 18:54:15
【问题描述】:

在非自动挂载的文件系统上,“mvn clean”有效(“mvn package”也是如此)。在自动挂载的文件系统上,“mvn clean”以下列方式失败:

 $ mvn clean
 [INFO] Scanning for projects...
 [INFO] 
 [INFO] ------------------------------------------------------------------------
 [INFO] Building glutmax-sentiment-analysis 1.0
 [INFO] ------------------------------------------------------------------------
 [WARNING] Failed to read tracking file /nethome/guest/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom.lastUpdated
 java.io.IOException: Input/output error
    at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
    at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:90)
    [...]
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
 Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
 [WARNING] Failed to write tracking file /nethome/guest/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom.lastUpdated
 java.io.IOException: Input/output error
    at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
    at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:90)
    [...]
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD FAILURE
 [INFO] ------------------------------------------------------------------------
 [INFO] Total time: 04:13 min
 [INFO] Finished at: 2017-07-12T11:34:55-07:00
 [INFO] Final Memory: 23M/1445M
 [INFO] ------------------------------------------------------------------------
 [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Input/output error -> [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/PluginResolutionException


 $ mvn -version
 Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
 Maven home: /usr/local/maven
 Java version: 1.8.0_121, vendor: Oracle Corporation
 Java home: /usr/local/jdk1.8.0_121/jre
 Default locale: en_US, platform encoding: UTF-8
 OS name: "linux", version: "3.10.0-514.el7.x86_64", arch: "amd64", family: "unix"

很明显,我遗漏了一些配置信息,但在寻找答案时,我发现我需要删除 ~/.m2/*, chmod 777 ~/.m2,并确保我的 JAVA_HOME 是正确的.这些建议都没有奏效。我错过了什么?

有趣的是,Gradle 似乎也不适用于自动挂载的文件系统。

【问题讨论】:

  • 用户能够创建目录、文件、更改权限等。“mount”输出显示用户具有“rw”权限:10.10.10.10:/ms/ms.share/services/ ps/guest on /nethome/guest type nfs (rw,relatime,vers=3,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans= 2,sec=sys,mountaddr=10.20.30.70,mountvers=3,mountport=2049,mountproto=tcp,local_lock=none,addr=10.20.30.70)
  • "用户可以创建目录" - 哪个用户?您确定是同一用户运行 Maven 作业吗?
  • 我相信是的。我可以登录并执行 mkdir ~/.m2,但是当我删除 ~/.m2 并执行“mvn 包”时,maven 报告“无法在 /nethome//.m2/repository 创建本地存储库”。我在挂载选项中添加了“hard,nolock,noac”,但仍然没有乐趣。

标签: java maven nfs automount


【解决方案1】:

这似乎是 NFS 问题。 JDK 委托给 Linux 的本机函数调用,而底层系统调用失败。尝试将 Maven 本地存储库目录指向本地文件系统。具体来说,在文件apache-maven-${version}/conf/settings.xml中,取消注释并更新行:

<localRepository>some_local_directory</localRepository>

【讨论】:

    【解决方案2】:

    以下似乎解决了写入问题。

    通过在自动挂载描述中添加 "hard,nolock,noac",用户现在可以运行 "mvn"。不幸的是,在本地文件系统上构建 1 分钟,在自动挂载的文件系统上大约需要 15 分钟。但这是 stackoverflow 的另一个问题/问题。

    【讨论】:

      猜你喜欢
      • 2020-12-06
      • 1970-01-01
      • 2015-05-04
      • 2014-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多