Non-resolvable import POM: Could not transfer artifact
Asked Answered
G

3

8

This my pom.xml and the errors I get are:

Non-resolvable import POM: Could not transfer artifact org.glassfish.jersey:jersey-bom:pom:2.9 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org @ line 14, column 25: Unknown host repo.maven.apache.org

and

'dependencies.dependency.version' for org.glassfish.jersey.containers:jersey-container-grizzly2-http:jar is missing. @ line 25, column 21

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>simple-service</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>simple-service</name>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey</groupId>
            <artifactId>jersey-bom</artifactId>
            <version>${jersey.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-grizzly2-http</artifactId>
    </dependency>
    <!-- uncomment this to get JSON support:
     <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
    </dependency>
    -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.9</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <inherited>true</inherited>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <mainClass>com.example.Main</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

<properties>
    <jersey.version>2.9</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

I have tried doing this but there wasn't any change. Can someone please guide me?

Gesticulative answered 6/6, 2014 at 14:14 Comment(5)
this is the problem: Unknown host repo.maven.apache.org check your network connection etc.Guide
Thanks, the network seems to be working fine.Gesticulative
But does the second error also network related?Gesticulative
If you have a Unknown host the network does NOT work. Or you have no internet access and might need to configure proxy etc. Apart from that after fixing networks things remove your complete local repository and start from scratch.Guide
possible duplicate of Unknown host error while executing MVN installToothache
G
14

Fixed the issue by modifying the settings.xml to reflect the firewall properties within my organisation. Thanks all.

Gesticulative answered 9/6, 2014 at 14:10 Comment(2)
I'm having the same kind of problem. Where is this settings.xml file located?Marshy
maven-installation-location/conf/settings.xmlThromboplastic
F
0

Yes I had same issue. It was because in settings.xml password was incorrect. After reset my correct password it was working fine.

Footed answered 12/7, 2021 at 16:30 Comment(0)
P
0

The problem may also be due to the fact that the version for both Maven and the JDK is not configured correctly.

Poky answered 9/10, 2023 at 18:55 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Borate

© 2022 - 2024 — McMap. All rights reserved.