Pierwola
Pierwola

Reputation: 135

Maven - missing artifact

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.

Upvotes: 7

Views: 64164

Answers (4)

navis1692
navis1692

Reputation: 308

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>

Upvotes: 3

ArtStack
ArtStack

Reputation: 5

If you use Cntlm as autetification proxy, check if it is alive in your Windows Tasks Manager:

cntlm.exe

If not, try executing on a cmd window:

call \path_to_your_cntlm_folder\Cntlm\cntlm.exe -c \path_to_your_cntlm_folder\Cntlm\cntlm.ini

Upvotes: 0

max-dev
max-dev

Reputation: 733

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!

Upvotes: 4

gerrytan
gerrytan

Reputation: 41123

There are few common causes related to maven migration

  • Your project consists of many internal dependencies (artifact created by yourself / colleagues) stored on your PC maven repository cache, as opposed in a shared internal repository. When you migrated into new PC it's no longer able to resolve these
  • Your company has an internal maven repository (eg: nexus) and your project pom.xml isn't configured to search for this repository
  • Your project is a multi module which aren't setup very neatly such that the topmost artifact in the dependecy map has to be installed first on your local repo before others can pull it
  • Your new pc repository use different maven version / jdk version combinations

Your pc local repo is normally located at ~/.m2/repository

Upvotes: 2

Related Questions