mvn在自动挂载的目录上失败

时间:2017-07-12 18:54:16

标签: java maven nfs automount

在非自动挂载的文件系统上," mvn clean"工作(" mvn包")。在自动安装的文件系统上," 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 似乎也不适用于自动挂载的文件系统。

2 个答案:

答案 0 :(得分:1)

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

<localRepository>some_local_directory</localRepository>

答案 1 :(得分:1)

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

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