Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven - missing artifact

Tags:

java

spring

maven

I've just moved my project from windows to linux ubuntu. After pulling files from repository it turned out that every pom.xml file consists errors. Not even one dependency injection isn't resolved.

I am using Spring Tool Suite Eclipse extension and have maven2 downloaded.

What could cause that? Thanks.

EDIT: after typing "mvn clean install -U" in console and physicly downloading few jars I've managed to reduce problem to just one pom.xml, but it still points errors in file that is correct at windows.

There is my pom.xml:

<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>id</groupId>
<artifactId>artifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>name</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java-version>1.7</java-version>
    <org.springframework-version>3.2.2.RELEASE</org.springframework-version>
    <org.slf4j-version>1.7.2</org.slf4j-version>
    <ch.qos.logback-version>1.0.7</ch.qos.logback-version>
</properties>

<repositories>
    <repository>
        <id>java.net2</id>
        <name>Repository hosting the jee6 artifacts</name>
        <url>http://download.java.net/maven/2</url>
    </repository>
    <repository>
        <id>sonatype-oss-repository</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework-version}</version>
        <exclusions>
            <!-- Exclude Commons Logging in favor of SLF4j -->
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>javax.jms</groupId>
        <artifactId>javax.jms-api</artifactId>
        <version>2.0</version>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${ch.qos.logback-version}</version>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Errors that I receive are:

  1. ArtifactDescriptorException: Failed to read artifact descriptor for ch.qos.logback:logback-classic:jar:1.0.7: ArtifactResolutionException: Failure to transfer ch.qos.logback:logback-classic:pom:1.0.7 from http://download.java.net/maven/2 was cached in the local repository, resolution will not be reattempted until the update interval of java.net2 has elapsed or updates are forced. Original error: Could not transfer artifact ch.qos.logback:logback-classic:pom:1.0.7 from/to java.net2 (http://download.java.net/maven/2): The operation was cancelled.

  2. Missing artifact aopalliance:aopalliance:jar:1.0

  3. Parent of resource: /home/user/workspace/artifact/name/target/classes/META-INF is marked as read-only.

  4. The container 'Maven Dependencies' references non existing library '/home/user/.m2/repository/org/springframework/spring-context/3.2.2.RELEASE/spring-context-3.2.2.RELEASE.jar'

Every of these repeats for few cases.

like image 292
Pierwola Avatar asked Jul 14 '13 21:07

Pierwola


People also ask

What does missing artifact mean?

xml “missing artifact maven” occurs when the artifact is missing in local repository and remote repository. In eclipse, missing artifact maven error shows in the programs window. Maven is a software tool for building artifacts. The maven exception “Missing artifact” is thrown when a new dependency is added in the pom.


2 Answers

Ok, so you've just moved from one OS to another...

There is a big chance, that Maven settings are different, and you just forgot to move some repositories configurations, etc. to the new place.

Please check global Maven settings.xml or user-specific: ~/.m2/settings.xml on Linux and C:\User\[username]\.m2\settings.xml on Windows.

Chances are you'll find something interesting.

After fixing settings (if it's the cause), I would suggest to run Maven dependency plugin goal 'purge-loca-repository' for removing your project's dependencies from your local Maven repository and re-resolving them from scratch:

mvn dependency:purge-local-repository

Regarding aopalliance-1.0 artifact -> I haven't found it in java.net2/sonatype repositories, so please try Maven Central to resolve it:

<repository>
  <id>central</id>
  <name>Maven Central</name>
  <url>http://repo1.maven.org/maven2</url>
</repository>

Good Luck!

like image 177
max-dev Avatar answered Sep 27 '22 21:09

max-dev


i added this and it resolved my problem.

<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-server -->
<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-server</artifactId>
    <version>1.8</version>
</dependency>
like image 27
navis1692 Avatar answered Sep 27 '22 21:09

navis1692