Maven 找不到我的离线依赖项/本地工件 ("not available in the local repository")?
Maven can't find my offline dependencies / local artifacts ("not available in the local repository")?
我正在尝试下载我所有的依赖项并让它们可以离线使用,但是当我 运行 mvn -o test
时,它显示 The repository system is offline but the artifact commons-io:commons-io:jar:2.4 is not available in the local repository
。但是,我的 ~/.m2/repository
中有这个包!
~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>true</offline>
</settings>
ls ~/.m2/repository/commons-io/commons-io/2.4/
_maven.repositories
commons-io-2.4.jar
commons-io-2.4.jar.lastUpdated
commons-io-2.4.jar.sha1
commons-io-2.4.pom
commons-io-2.4.pom.sha1
mvn -o 测试
[ERROR] Failed to execute goal
com.github.temyers:cucumber-jvm-parallel-plugin:2.0.2:generateRunners
(generateRunners) on project myproject: Execution
generateRunners of goal
com.github.temyers:cucumber-jvm-parallel-plugin:2.0.2:generateRunners
failed: Plugin com.github.temyers:cucumber-jvm-parallel-plugin:2.0.2
or one of its dependencies could not be resolved:
The repository
system is offline but the artifact commons-io:commons-io:jar:2.4 is
not available in the local repository. -> [Help 1]
问题
基本上 maven 说我没有 ~/.m2/repository/commons-io/commons-io/2.4/,但我 有!
我试过这个:
find ~/.m2/repository -name _maven.repositories -exec rm -v {} \;
但是在删除_maven.repositories
之后,当我运行mvn -o test
,文件又回来了!
我有行家3.0.5
这 3 件事让它发挥作用(感谢@Tunaki)
- 将
-o
放在 mvn 命令的末尾。 示例 mvn test -o
。刚开始用的时候没用
- 删除所有
*.lastUpdated
个文件。
find ~/.m2/repository -name *.lastUpdated -exec rm -v {} \;
- 删除所有
_maven.repositories
个文件。
find ~/.m2/repository -name _maven.repositories -exec rm -v {} \;
注意:settings.xml
是否存在或删除都没有区别。所以我认为它没有任何作用。
我正在尝试下载我所有的依赖项并让它们可以离线使用,但是当我 运行 mvn -o test
时,它显示 The repository system is offline but the artifact commons-io:commons-io:jar:2.4 is not available in the local repository
。但是,我的 ~/.m2/repository
中有这个包!
~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>true</offline>
</settings>
ls ~/.m2/repository/commons-io/commons-io/2.4/
_maven.repositories
commons-io-2.4.jar
commons-io-2.4.jar.lastUpdated
commons-io-2.4.jar.sha1
commons-io-2.4.pom
commons-io-2.4.pom.sha1
mvn -o 测试
[ERROR] Failed to execute goal com.github.temyers:cucumber-jvm-parallel-plugin:2.0.2:generateRunners (generateRunners) on project myproject: Execution generateRunners of goal com.github.temyers:cucumber-jvm-parallel-plugin:2.0.2:generateRunners failed: Plugin com.github.temyers:cucumber-jvm-parallel-plugin:2.0.2 or one of its dependencies could not be resolved:
The repository system is offline but the artifact commons-io:commons-io:jar:2.4 is not available in the local repository. -> [Help 1]
问题
基本上 maven 说我没有 ~/.m2/repository/commons-io/commons-io/2.4/,但我 有!
我试过这个:
find ~/.m2/repository -name _maven.repositories -exec rm -v {} \;
但是在删除_maven.repositories
之后,当我运行mvn -o test
,文件又回来了!
我有行家3.0.5
这 3 件事让它发挥作用(感谢@Tunaki)
- 将
-o
放在 mvn 命令的末尾。 示例mvn test -o
。刚开始用的时候没用 - 删除所有
*.lastUpdated
个文件。find ~/.m2/repository -name *.lastUpdated -exec rm -v {} \;
- 删除所有
_maven.repositories
个文件。find ~/.m2/repository -name _maven.repositories -exec rm -v {} \;
注意:settings.xml
是否存在或删除都没有区别。所以我认为它没有任何作用。