我试图向我的项目添加一个新的依赖项(Easy-Rules):
Missing artifact org.jeasy:easy-rules:jar:4.1.0
如果我尝试运行 maven clean install
Failed to execute goal on project architecture-utils: Could not resolve dependencies for project com.paulmarcelinbejan:architecture-utils:jar:1.0.0: org.jeasy:easy-rules:jar:4.1.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
为什么会这样? 可以在 repo.maven.apache.org 轻松找到简单规则
这只会在这种依赖下发生。
例如,如果我从 maven 中央存储库 (msgpack) 添加另一个依赖项,它就可以正常工作。
并且 jar 文件已正确下载到本地存储库中。
我的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.paulmarcelinbejan</groupId>
<artifactId>architecture</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>architecture-utils</artifactId>
<properties>
<easyrules.version>4.1.0</easyrules.version>
</properties>
<dependencies>
<dependency>
<groupId>com.paulmarcelinbejan</groupId>
<artifactId>architecture-constants</artifactId>
</dependency>
<dependency>
<groupId>com.paulmarcelinbejan</groupId>
<artifactId>architecture-annotations</artifactId>
</dependency>
<!-- Jackson -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.jeasy</groupId>
<artifactId>easy-rules</artifactId>
<version>${easyrules.version}</version>
</dependency>
</dependencies>
</project>
我的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}/Develop/Personal/maven/repository</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
</settings>
如果你看一下 Maven Central 上的文件,你会发现没有 JAR。该工件仅包含一个 pom 文件及其散列和签名。
easy-rules
只是父项目,包括其模块的配置。
但是如果你想使用(非 pom)依赖,你需要使用一个实际包含 JAR 的工件。在您的情况下,这可能是 easy-rules-core:
<dependency>
<groupId>org.jeasy</groupId>
<artifactId>easy-rules</artifactId>
<version>${easyrules.version}</version>
</dependency>
这也包含在easy-rules GitHub存储库
的wiki的
Use with Maven
-section中。