dependencies from pom.xml not being resolved

Maifee Ul Asad :

I'm trying to create a maven project in intellij, to create a parser in antlr. Here is 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>
    <groupId>com.mua</groupId>
    <artifactId>json-parser-java-antlr</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Json parser Java ANTLR</name>
    <packaging>jar</packaging>
    <description>Trying to create a parser using ANTLR in Java, as facing problems with LLVM</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr4-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.directory.studio</groupId>
            <artifactId>org.apache.commons.io</artifactId>
        </dependency>
    </dependencies>
</project>

When I click on import changes, it loads for just 1-2 seconds then done. But if I try to import MapUtils from org.apache.commons.collections4.MapUtils it says it can't resolve common, although I added in <groupId>org.apache.commons</groupId> dependency.

I'm new in maven project creation and management.

So, what is the problem here and how can I resolve this problem ?

I studied some pom.xml and found a parent attribute. No idea how to configure that.

Andreas :

My Eclipse editor shows:

Project build error: 'dependencies.dependency.version' for org.antlr:antlr4-runtime:jar is missing.
Project build error: 'dependencies.dependency.version' for org.apache.commons:commons-collections4:jar is missing.
Project build error: 'dependencies.dependency.version' for org.apache.directory.studio:org.apache.commons.io:jar is missing.

None of the dependencies work, because it doesn't know which version of them you want.

Specifying dependencies without a version is something you do when you have a parent pom. You don't, so versions are mandatory.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=409755&siteId=1