Search code examples
javamavendependenciespom.xml

Missing Artifact, Could not resolve dependencies, was not found in https://repo.maven.apache.org/maven2 during a previous attempt


I was trying to add a new dependency (Easy-Rules) to my project:

but the dependency tag is underlined in red: enter image description here

Missing artifact org.jeasy:easy-rules:jar:4.1.0

and if I try to run a 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]

Why is this happening? easy-rules can be easily found at repo.maven.apache.org

This is only happening with this dependency.

for example if I add another dependency from maven central repository (msgpack), it is perfectly working. enter image description here

and the jar file is correctly downloaded into local repository.

My 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>

My 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>

Solution

  • If you take a look at the files on Maven Central, you can see that there is no JAR. The artifact only consists of a pom-file and its hash and signature. easy-rules is just the parent project including configuration for its modules.

    But if you want to use a (non-pom)-dependency, you need to use an artifact that actually contains a JAR. In your case, this could be easy-rules-core:

    <dependency>
        <groupId>org.jeasy</groupId>
        <artifactId>easy-rules-core</artifactId>
        <version>${easyrules.version}</version>
    </dependency>
    

    This is also included in the Use with Maven-section of the wiki of the easy-rules GitHub repository.