1

在非自动挂载的文件系统上,“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似乎也不适用于自动挂载的文件系统。

4

2 回答 2

1

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

<localRepository>some_local_directory</localRepository>
于 2017-07-14T05:16:25.637 回答
1

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

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

于 2017-07-19T18:11:21.087 回答